简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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