jQuery模拟点击获取按URL过滤的多图库
我有一个用 Elementor 创建的网站。网站属于摄影师。他在那里有一个 Elementor Multigallery,顶部有过滤器。我需要创建外部链接,它可以将您带到子页面并直接仅显示过滤后的项目。
这是 multigal 的链接: https://chosephoto.com/photo/
我需要做类似的事情,当我输入 https://chosephoto.com/photo/#fashion 时,我将收到当前子页面,但它只会显示“时尚”画廊中的图像。并非所有图像。
我想过模仿 jQuery 通过查询字符串单击(获取 /#.... 的值),然后执行 jquery 单击 with 属性,该属性等于查询字符串中的值,但是我什至不知道,我该怎么办用 jQuery 来做。我是 jQuery 初学者。
谢谢你的帮助。
I have website, created with Elementor. Website belongs to photographer. He has got there an Elementor Multigallery, with filter at the top. I need to create external links, which can bring you to the subpage and directly show only filtered items.
Here's the link to multigal: https://chosephoto.com/photo/
I need to do something like that, when I enter the https://chosephoto.com/photo/#fashion I will received the current subpage, but it will shows only images from gallery "fashion". Not all images.
I thought about imitating jQuery click by query string (get the value of /#....) and then do the jquery click the with attribute, which equals the value in query string, However I even don't know, how can I do it with jQuery. I am jQuery beginner.
Thank you for a help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所以,最后,这是我的“解决方案”,
我必须使用 .bind('load'),而不是 document.ready() 函数,因为画廊在文档准备好后执行额外的 javascript (并且它已经覆盖了我的代码) 。
您可以根据末尾的主题标签调用过滤器并获取 URL。例如,此 URL:https://chosephoto.com/photo/#fashion 将过滤 FASHION画廊。
我的知识还不够,还想做得更好。但它有效!
So, finally, here's my "solution"
I had to use .bind('load'), instead of document.ready() function, because the gallery do the additional javascript after the document is ready (and it has overwritten my code).
You can call the filter with getting the URL, based on the hashtag at the end. For example this URL: https://chosephoto.com/photo/#fashion will filter the FASHION gallery.
My knowledges are not enough, to do it better way. But it works!
我一直在寻找工作代码,但没有任何效果,这就是我所做的,适用于链接 WordPress 画廊中的画廊类别
所以此代码适用于带有画廊的页面,并且您可以将类别链接为 #0 ,# 1等(数字与画廊索引相同)
i was looking for working code, but nothing worked, here's what i've done, that works for linking gallery categories in WordPress gallery
So this code is for the page with a gallery, and than you can link a category as #0 ,#1 etc. ( number is same as gallery index)