Template:Team:Sheffield/NavigationBar

From 2014.igem.org

(Difference between revisions)
Line 28: Line 28:
$(document).ready(function() { // Document ready
$(document).ready(function() { // Document ready
$( '.inlink' ).on('click', function(event) {
$( '.inlink' ).on('click', function(event) {
-
    event.preventDefault();
+
    var target = $(this.hash);
-
    var target = "#" + $(this).data('target');
+
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
-
    $('html, body').animate({
+
if (target.length) {
-
        scrollTop: $(target).offset().top
+
$('html,body').animate({
-
    }, 2000);
+
scrollTop: target.offset().top
 +
}, 1000);
 +
return false;
 +
}
});
});
});
});

Revision as of 10:58, 4 October 2014