Solving jScrollPane Issues with jQuery Slideup

JTS

We ran into a problem where a jScrollPane was not showing up on a longer div, when it was slide up using jQuery’s “slideDown”/”slideUp”.

After much debugging, we discovered that jScrollPane was actually being applied, however it was NOT calculating the actual DIV height correctly.

The solution was to resize the element after it had been slid up and then create the actual jScrollPane element.

//....
            $(this).toggleClass('active').next().slideDown('fast', function() {
 
                //just opened safety info, re-init the bar
                if(thisID=='our_main_trigger'){
                    //trigger a resize to make sure everything is set
                    $(window).trigger('resize');
                    //get our incorrect height.
                    jaspcon=$('.mobile-content').height();
                    //padding for our mobile resize.  Height is misreported..jpanel got confused
                    var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0)
                    jaspcon=$('.mobile-content').height(h-150);
                    //NOW create the jScrollPane
                    $('.scroll-pane-mob-ini').show().jScrollPane({
                       autoReinitialise:true,		
                        verticalDragMinHeight: 23,
                        verticalDragMaxHeight: 23,
                        horizontalDragMinWidth: 11,
                        horizontalDragMaxWidth: 11
                    });
 
 
                }
            });

Contact Us for any of your web application development needs.

Jeremy T. Silva, owner of Silva Tech Solutions

About the author

Jeremy T. Silva is the owner of Silva Tech Solutions and works as a fractional CIO for mid-market manufacturers, engineering firms, and service companies across Eastern Pennsylvania and New Jersey. He sets technology strategy, governs AI adoption, and holds vendors accountable, without reselling products or taking referral fees. He has twenty-five years of IT leadership experience, including director-level roles in healthcare and corporate events.