Skip to content Skip to sidebar Skip to footer

JQuery ScrollTo And Hide An Element

According to my last post, I asked how to make a div, which fills the screen, scroll to another div. Which i have hidden, so i had to fade in that element first. That works now. Bu

Solution 1:

try this fiddle

$(document).ready(function() {
    $('#exploreBtn').on('click', function() {
        $('#content').fadeIn(500);
        console.log($("#content").offset().top)
        $('html, body').animate({
            scrollTop: $("#content").offset().top
        }, 1000, function(){
            $("#page1").css('display','none');
            $('#content').css('top',0); 
            $(window).scrollTop(0);       
        });
    });
});

Post a Comment for "JQuery ScrollTo And Hide An Element"