简体   繁体   中英

Scrollbar Doesn't Move in jQuery slimScroll Using ScrollTo

When you click a button, I am trying to make the div scroll to a certain position using jQuery slimScroll . This works, but the scrollbar does not move with it. See my small JSFiddle here: http://jsfiddle.net/retvL2s6/1/

$('.text').slimScroll({
    height: '250px',
    alwaysVisible: true,
    size: '10px'
});

As you can see, after clicking on the button, the div scrolls to 260px. Now try putting the mouse in the div and start scrolling. It resets to the beginning because the scrollbar is still at the top. It does not move with the div when the button is clicked.

This is what I am using to move to certain px: $('.text').slimScroll({ scrollTo: '450px' }); , as indictated in the plugin documentation.

I have the feeling that this plug in doesn't do what you are looking for. For better performance and future flexibility I can advise you to look at the examples of this plugin:

http://balupton.github.io/jquery-scrollto/

with this one you can do whatever you want!

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM