Karl Swedberg schrieb:
> ok, now that the smooth scrolling has Klaus's blessing :) ... I thought 
> I'd share some code I wrote to make it happen for all same-page links. 
> It takes into account the difference in the way the various browsers 
> treat href.
> 
> Oh yeah, now that Brandon has fixed that for .attr('href') in the latest 
> SVN, the code could be shortened a great deal. Unfortunately, I don't 
> have time just now to do that, so here is the old code, which won't 
> break anything with latest SVN, and will also make things work in older 
> jQuery versions (the Interface ScrollTo plugin is required):

Nice karl!

The following:

 >     var $linkHref = $(this).href();
 >     var linkHashIndex = $linkHref.indexOf('#');
 >     var linkURL = $linkHref.slice(0,linkHashIndex);
 >     var linkHash = $linkHref.slice(linkHashIndex);


you could also write as

var linkHash = this.hash;

;-)


-- Klaus

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to