Scroll inside div with jquery?
If I have a div that is overflowing, is there a way I co开发者_运维技巧uld call a jquery function to scroll it down 60px or something?
Yes you can use ScrollTo plugin.
UPDATE Seems like link is broken now. New link here
Or, simply use the scrollTop() jQuery API call.
mine is going like this:
var offset = item.position().top;
if (offset < 0 || offset > parent.height()) {
if (offset < 0)
offset = parent.scrollTop() + offset;
parent.animate({ scrollTop: offset }, 300);
}
精彩评论