> 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;
> }
> }
> }
> });
Avoid some duplicate code here!
$('[EMAIL PROTECTED]"#"]').click(function() {
if (location.pathname == this.pathname && location.host == this.host) {
var target = $(this.hash);
target = target.size() && target || $("[EMAIL PROTECTED]" +
this.hash.slice(1) +']');
if (target.size()) {
target.ScrollTo(400);
return false;
}
});
-- Klaus
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/