On Feb 18, 2007, at 5:51 AM, Sam Collett wrote:
Are you aware of the pathname and host properties? If you use it, you
can cut down the code further:
$('[EMAIL PROTECTED]"#"]').click(function() {
if (location.pathname == this.pathname && location.host ==
this.host) {
if ($(this.hash).length > 0 ) {
$(this.hash).ScrollTo(400);
return false;
} else {
$linkDest = $("[EMAIL PROTECTED]" + this.hash.slice(1) +']');
if ($linkDest.length > 0) {
$linkDest.ScrollTo(400);
return false;
}
}
}
});
Ah! That is beautiful, Sam! Thanks!
You know, sometimes I make things much harder for myself than they
have to be, just because I fear the browser (IE in particular)
inconsistencies. So, instead of using a few simple, built-in
JavaScript properties, I use the one I know works and slice it up the
hard way.
Cheers,
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/