View Single Post
Old 08-24-2011, 02:36 PM  
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,513
jquery buffs, question for you

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);
        }
    });
});
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


My Cam Feeds Script / Free Templates / Gallery Scraper
fris is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote