Template:Team:Sheffield/NavigationBar

From 2014.igem.org

(Difference between revisions)
Line 1: Line 1:
-
{{Team:Sheffield/JS:smoothScrolling}}
 
{{Team:Sheffield/JS:jquery}}
{{Team:Sheffield/JS:jquery}}
Line 169: Line 168:
        $("#navigationBar > li > ul > li > a").removeClass("scrolling");
        $("#navigationBar > li > ul > li > a").removeClass("scrolling");
    }
    }
 +
});
 +
</script>
 +
<script>
 +
$(document).ready(function() { // Document ready
 +
$('a[href^="#"]').on('click',function (event) { // Hyperlink clicked
 +
    event.preventDefault(); // Remove current event
 +
 +
    var target = this.hash,
 +
    $target = $(target); // Get internal link
 +
 +
    $('html, body').stop().animate({ // Animate
 +
        'scrollTop': $target.offset().top
 +
    }, 500, 'swing', function () {
 +
        window.location.hash = target;
 +
    });
 +
});
});
});
</script>
</script>

Revision as of 21:25, 13 September 2014