jQuery isotope:根据 get 变量过滤页面加载
我正在使用 jQuery 同位素插件,并且希望在页面加载时仅显示特定组中的项目。目前所有项目都显示:
http://aproposstudio.com/category/work/
例如,在上面的链接上,有没有办法加载显示“壁画”的页面?
谢谢。
I am working with the jQuery isotope plugin and would like to display only items from a particular group when the page loads. Currently all of the items are displaying:
http://aproposstudio.com/category/work/
For example, on the link above, is there a way to load the page with the 'murals' displaying?
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
答案很简单:
在代码中使用这一行。
请参阅此链接:http://isotope.metafizzy.co/docs/filtering.html
The answer is quite easy:
Use this line in your code.
Refere this link: http://isotope.metafizzy.co/docs/filtering.html
所以我认为您只想使用简单的 hide() 和 show() 方法
如果您使用应用于 html 元素的类,您可以轻松选择它们并使用以下 jQuery 行隐藏它们。
现在,这将“隐藏”所有项目,只显示壁画。
这有道理吗?
So i think you just want to use the simple hide() and show() methods
If you use the classes applied to your html elements, you can easily select them and hide them with the following jQuery lines.
now, what this will do is 'hide' all of the projects, and show only the murals.
Does that make sense?
很简单!
It's very simple!
我的画廊遇到了同样的问题,我看到了你的帖子。非常感谢你的帮助,这真的让我很开心!
这是我使用的最终代码,这可能对面临类似问题的其他人有所帮助。
首先,我为图库设置了一个默认过滤器值,最初设置为“*”以显示所有项目。单击菜单中的链接时,此默认过滤器会发生变化,如下所示:
这是图库的过滤器按钮:
然后,对于 JavaScript:
我希望这样帮助任何面临类似问题的人!如果您有任何疑问,请随时与我们联系。
I encountered the same issue with my gallery, and I came across your post.Thank you very much for your help, it really made my day!
Here's the final code I used, which might be helpful for others facing a similar problem.
First, I set a default filter value for the gallery, initially set to "*" to show all items. This default filter changes when clicking on a link in the menu, which looks like this:
Here are the filter buttons for the gallery:
Then, for the JavaScript:
I hope this helps anyone facing a similar issue! Feel free to reach out if you have any questions.