我尝试将jscrollpane分配给两个div(.scrollpane)。但不幸的是,仅在悬停时显示滚动条的功能对第一个元素工作正常。第二个是可见的。
$(function() { var $el = $('.scrollpane').jScrollPane({ verticalGutter : 16 }), extensionPlugin = { extPluginOpts : { mouseLeaveFadeSpeed : 500, hovertimeout_t : 1000, useTimeout : true, deviceWidth : 980 }, hovertimeout : null, isScrollbarHover: false, elementtimeout : null, isScrolling : false, addHoverFunc : function() { if( $(window).width() ').css({ position : 'absolute', left : $vBar.css('left'), top : $vBar.css('top'), right : $vBar.css('right'), bottom : $vBar.css('bottom'), width : $vBar.width(), height : $vBar.height() }).bind('mouseenter.jsp',function() { clearTimeout( instance.hovertimeout ); clearTimeout( instance.elementtimeout ); instance.isScrollbarHover = true; instance.elementtimeout = setTimeout(function() { $vBar.stop( true, true ).jspmouseenter(); }, 100 ); }).bind('mouseleave.jsp',function() { clearTimeout( instance.hovertimeout ); instance.isScrollbarHover = false; instance.hovertimeout = setTimeout(function() { if( !instance.isScrolling ) $vBar.stop( true, true ).jspmouseleave( instance.extPluginOpts.mouseLeaveFadeSpeed || 0 ); }, instance.extPluginOpts.hovertimeout_t ); }); $vBar.wrap( $vBarWrapper ); } } }, jspapi = $el.data('jsp'); $.extend( true, jspapi, extensionPlugin ); jspapi.addHoverFunc(); });