whats the difference between the first function and the 2nd.
Code:
jQuery(document).ready(function($) {
$('body a').click(function(e) {
hostname = $(this).prop('hostname');
hash = $(this).prop('hash');
if ((window.location.hostname == hostname) && (hash !== '')) {
var hash_selector = hash.replace(/([ !"$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g, '\\$1');
if ( $( hash_selector ).length > 0 )
target = hash;
else {
anchor = hash;
anchor = anchor.replace('#', '');
target = 'a[name="' + anchor + '"]';
}
e.preventDefault();
$('html, body').animate({scrollTop: ($(this.hash)).offset().top}, 400);
}
});
});
jQuery(document).ready(function($) {
$('a[href*=#]').click(function (e) {
if ($(this.hash).length) {
e.preventDefault();
$('html,body').animate({scrollTop: ($(this.hash)).offset().top}, 1000);
}
});
});