Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jQuery mobile anchor link on the same page

//jQuery anchor link on the same page
$('#menu a[href^="#"]').on(click, function (event) {
    var target = $(this.getAttribute('href'));
 
    if (target.length) {
        event.preventDefault();
        closeMenu();
        $('html, body').animate({
            scrollTop: target.offset().top
        }, 1000)
    }
});
Source by www.thiscodeworks.com #
 
PREVIOUS NEXT
Tagged: #jQuery #mobile #anchor #link #page
ADD COMMENT
Topic
Name
3+4 =