$(document).ready(function() { $(‘a[href*=#]’).click(function() { if (location.pathname.replace(/^//,”) == this.pathname.replace(/^//,”) && location.hostname == this.hostname) { var $target = $(this.hash); $target = $target.length && $target || $(‘[name=’ + this.hash.slice(1) +‘]’); if ($target.length) { var targetOffset = $target.offset().top; $(‘html,body’) .animate({scrollTop: targetOffset}, 900); return false; } } }); // how to use // place this […]
Articles Tagged: HTML5
HTML5 Data Attributes
HTML5 data attributes are a simple means to embed data in a webpage. It is useful for exchanging data between the server and the front end, something that used to require outputting <script> blocks or hidden markup. With the recent updates to the jQuery data() method, HTML5 data attributes are pulled automatically and are available […]