javascript - 使用 .show() 和 .hide() 具有两个不同的功能,而不会相互冲突

标签 javascript jquery css filter show-hide

请看这里:http://jsfiddle.net/mAMY2/1/

如您所见,除了“显示更多”功能外,还有一个过滤器功能。我想改变“显示更多”功能的方式,以避免与过滤功能发生冲突。例如,也许有 .show() 和 .hide() 的替代方法?

冲突总结:

The "Show More" function and "Filter" function both work by manipulating the display value. If, for example, only three out of nine boxes are showing and you choose to filter a specific category, more than three boxes could potentially be displayed. Similarly, if you choose to only > display a specific category, but then wish to show more, the other category will also be ?> displayed.

谢谢

最佳答案

您可以使用 .addClass.removeClass,然后使用 css 控制可见性。

关于javascript - 使用 .show() 和 .hide() 具有两个不同的功能,而不会相互冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12840718/

相关文章:

css - 我的 CSS 被 Bootstrap CSS 覆盖了

javascript - 在 Rails 中读取 cookie 值

java - 将数据从 JSP 发送到 servlet

jquery - 这个切换按钮如何通过 CSS 工作?

javascript - 如何将 jQuery live 绑定(bind)到整个窗口?

javascript - IE8 及以下 <input type ="image"> value work around

css - reactjs - 容器中的水平行 png 图像

javascript - 按当天动态更改应用程序的内容

javascript - availableWidth 在 mozilla 和 IE 中不起作用

javascript - CSS Html 使图像出现在单选按钮的选项上(单选按钮被 CSS 隐藏)