You cannot copy content of this page

Javascript Smooth Scroll to Element

You know that special effect where you click on a link and your browser smoothly scrolls down to the appropriate section of the page? that is Javascript Smooth Scroll to Element.

Add this js code snippet in you js file and see the magic!

[code]<script>
$(document).ready(function(){
$(“a”).on(‘click’, function(event) {

if (this.hash !== “”) {
event.preventDefault();

var hash = this.hash;

$(‘html, body’).animate({
scrollTop: $(hash).offset().top
}, 800, function(){

window.location.hash = hash;
});
}
});
});
</script>[/code]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.