jscrollpane - addHoverFunc - only works for the first element
I tried to assign jscrollpane to two divs (.scrollpane). But unfortunately
the function to show the scrollbar only on hover just works fine for the
first element. The second one is allways visible.
$(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();
});
No comments:
Post a Comment