So I have the following website: http://www.gameplay-universe.uphero.com/
You can see the "Skip to Content" link. I want when it's clicked the page to scroll to div#content. I am using the latest version of jQuery. How can I achieve this?
So I have the following website: http://www.gameplay-universe.uphero.com/
You can see the "Skip to Content" link. I want when it's clicked the page to scroll to div#content. I am using the latest version of jQuery. How can I achieve this?
 
    
    OK here's the solution I've found:
$(document).ready(function() {
// Click event for any anchor tag that's href starts with #
$('a[href^="#"]').click(function(event) {
    // The id of the section we want to go to.
    var id = $(this).attr("href");
    // An offset to push the content down from the top.
    var offset = 60;
    // Our scroll target : the top position of the
    // section that has the id referenced by our href.
    var target = $(id).offset().top - offset;
    // The magic...smooth scrollin' goodness.
    $('html, body').animate({scrollTop:target}, 500);
    //prevent the page from jumping down to our section.
    event.preventDefault();
});
});
That worked for me.
 
    
    $("li a").click(function(){
    $('html, body').animate({
        scrollTop: $( $.attr(this, 'href') ).offset().top
    }, 1000);
    return false;
}); 
this gonna work for all links inside li elements.
 
    
    Here is a script I like to use whenever I want to enable a "scroll to" type of Jquery effect.
