开发者

jquery using filter to separate elements and act on them differently

I have a .infodiv class with say 4 elements. I want to filter out 1 div by id and fadeToggle it, and fadeOut the o开发者_开发百科thers.

My code now is

$(".infodiv").filter('#'+id+"div").fadeToggle("slow").fadeOut("slow");

this now filters and acts correctly on my filter, but then the following fadeout command would also act on the filtered element.

What extra commands/syntax in the chain is needed so that the fadeout only acts on the other 3 elements.

TIA


You can revert to the previous set in the chain if you use end().

$(".infodiv").filter('#'+id+"div").fadeToggle("slow").end().fadeOut("slow");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜