链接“兄弟姐妹”和“不”方法
我目前正在尝试链接 .siblings 和 .not 方法:
$(nextBanner).siblings(".banner").not(".active").hide();
但它不起作用 – 有人知道如何定位一组兄弟姐妹并排除具有特定类别的兄弟姐妹吗?
您可以在这里观看我的示例:http://jsfiddle.net/timkl/56Mqg/25/
I'm currently trying to chain the .siblings and .not method:
$(nextBanner).siblings(".banner").not(".active").hide();
But it doesn't work – does anyone know how to target a set of siblings and exclude the ones that have a particular class?
You can watch my example here: http://jsfiddle.net/timkl/56Mqg/25/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
试试这个
,
你的代码有一些缺陷,我已经在你的小提琴中纠正了这些缺陷。看看它。
工作演示
Try this
and
Your code have few flaws which I have corrected in your fiddle. Take a look at it.
Working demo
尝试:
Try:
也尝试一下
,您可以执行
$(".banner").hide()
然后$(nextBanner).show();
try this
also you could do a
$(".banner").hide()
and then$(nextBanner).show();
您只是忘记删除
active
类。我对你的例子做了一点修改(而且我根本不使用siblings()
),所以它可以工作:http://jsfiddle.net/56Mqg/27/you simply forgot to remove the
active
-class. i modified you example just a tiny bit (and i don't usesiblings()
at all) so it works: http://jsfiddle.net/56Mqg/27/