jQuery-slimScroll
jQuery-slimScroll copied to clipboard
alwaysVisible:true and scrollTo scrollbar disappear issue
Hi! Very nice plugin. My issue is following:
-
initiate plugin with code
$('.slimscroll').slimScroll({ position: 'right', height: '425px', railVisible: true, alwaysVisible: true, color: '#f00' });
-
try to dynamically scroll to element inside
var ii_sel = $('.inside-item[data-id=12]'); $('.slimscroll').slimScroll({ scrollTo: ii_sel.position().top });
Content scrolls well, but the problem is after scrolling the scrollbar is disappearing.
This happens because plugin is not checking very well previous instance. Problem solutions:
- when plugin is instantiated first time add data property with initial options and when is called second time load options from data and extend with current passed options.
` // check for an old instance var old_instance = me.data('slimScroll');
if(old_instance){ // true - has previous instance
// use previous options
o = $.extend(me.data('slimScroll'), options);
// update instance options
me.data('slimScroll', o);
} else { // false - no previous instance
// set initial options
me.data('slimScroll', o);
}
`
Hi, Anyone here I'm facing the same problem. @catiraumihail did you solved this issue ?
@umair-khanzada Hi! Yes I solved this issue by editing original plugin and add some checks of previous instance
How you resolved this issue. can you please share your experience with me ?
I simply added alwaysVisible: true,
to the second command with scrollTo
to solve this