You can replace .css({display:'block'}) with .show() and
.css({display:'none'}) with .hide().
Using document.location.hash.chartAt(1) will cut off any id with more
then one character, removing charAt(1) should make that much more
flexible.
Jörn
On Tue, Sep 23, 2008 at 10:27 AM, hcvitto [EMAIL
replace this:
var hash;
if (document.location.hash)
var hash = (document.location.hash).charAt(1);
with:
var hash;
if (document.location.hash)
hash = document.location.hash.slice(1);
Maybe you want slice(1) because charAt(1) only returns 1 character and
slice(1) would return the hole hash
Some small byte savings:
/* replace this: */
if (hash) {
obj.children('a[href=#' + hash + ']').addClass(classe);
obj.children('dl[id=' + hash + ']').css({display:'block'});
} else {
obj.children('a:first').addClass(classe);
obj.children('dl:first').css({display:'block'});
}
/*
Thanks guys for the quick reply!!
I did as you suggested (Joel) and i saved some bits;i guess in a
bigger plugin that would be even more useful.
As for the hash thing i need just to identify the first letter after
the hash sign to open the corresponding block when i come from another
page so
4 matches
Mail list logo