Actually, "normal" is not default for .show() and .hide() -- even
though it is the default for all the .slideX() methods and .fadeIn
()/.fadeOut().
Without a parameter, .show() and .hide() act differently -- just
applying the display=none or display=block/inline to the matched set
of elements. For them to use the animation, a parameter must be
inlcluded.
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Feb 21, 2007, at 7:01 AM, Gorkfu wrote:
Thx, that does clean it up a lot. =)
As for normal being default for show and hide, I think the default
doesn't
work correctly, or there is no default. Testing it blank in IE7 and
Firefox2, the checkboxes disapear faster than when set to normal
setting.
Karl Rudd wrote:
You could combine those two and stick them both in the document HEAD,
since they both run on "ready" (see other email for why).
There's no need to for the "filter()" function in this case, the
"each()" function will do fine. Both iterate over the collection of
objects, but "filter" is meant for "filtering", as in removing some
elements.
Hmmm and there's some other small optimisations. For example
factoring
the hide/show code into it's own function. Can change
"[EMAIL PROTECTED]'checkbox']" to ":checkbox".
Also "normal" is default for show() and hide().
If I may suggest the following (untested):
$(document).ready(function(){
function visibleCheck() {
var $this = $(this);
var ul = $this.siblings("ul");
if ($this.is(":checked"))
ul.hide();
else
ul.show();
}
$(":checkbox")
.click(visibleCheck)
.each(visibleCheck);
});
Karl Rudd
--
View this message in context: http://www.nabble.com/Loop-Checkbox-
Action-Question-tf3246372.html#a9079695
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/