开发者

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);
            }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜