简体   繁体   English

使用JQuery slidetoggle()时向下滚动

[英]scrolling down when using JQuery slidetoggle()

I have 2 footer (footer-larg) & (footer-bottom) i need when i click a link in footer-bottom (flip) .. footer-larg toggle && scroll down to footer-bottom 我有2个页脚(footer-larg)和(footer-bottom),当我单击footer-bottom(flip)中的链接时我需要。.footer-larg切换&&向下滚动至footer-bottom

until now footer-larg toggle but not scroll down 到现在为止,页脚大切换但不向下滚动

$("#flip").click(function() {
        $("#footer-large").slideToggle("slow");
                    if ($("#footer-large").is(':visible')) {
                        $("html, body").animate({scrollTop: $("#footer-large").offset().top});
                     }                       
    });

Why not let the browser handle the scroll? 为什么不让浏览器处理滚动?

Try this: 尝试这个:

$("#flip").click(function() {
    $("#footer-large").slideToggle("slow");
    if ($("#footer-large").is(':visible')) {
        window.location = '#footer-large';
    }                       
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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