开发者

How to scroll to an element after expanding with slideToggle?

scrollTo is not scrolling to a 开发者_开发技巧div that expands past the bottom of the page... any suggestions? (jQuery 1.3, scrollTo 1.42)

function toggleCollapsible(ownerDiv) {
    ownerDiv.next(".Collapsible").slideToggle("fast", 
                                              $.scrollTo(ownerDiv, "slow"));
}


Tried your code and it works, but you forgot to specify, that $.scrollTo should be inside an anonymous function (callback after slideToggle finishes toggling) and it even scrolled to under bottom of page..

function toggleCollapsible(ownerDiv) {
    ownerDiv.next(".Collapsible").slideToggle("fast", function(){
        $.scrollTo(ownerDiv, "slow");
    });
}
toggleCollapsible($("#target"));
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜