开发者

How to scroll to an element after expanding with slideToggle?

开发者 https://www.devze.com 2022-12-08 14:16 出处:网络
scrollTo is not scrolling to a 开发者_开发技巧div that expands past the bottom of the page... any suggestions? (jQuery 1.3, scrollTo 1.42)

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

精彩评论

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