开发者

jquery using filter to separate elements and act on them differently

开发者 https://www.devze.com 2023-04-11 07:51 出处:网络
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.

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

精彩评论

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