简体   繁体   English

jQuery手风琴插件-SHOPIFY

[英]jQuery Accordion plugin - SHOPIFY

I'm hoping someone can help to answer my question... 我希望有人可以帮助回答我的问题...

I am currently using an accordion on my Shopify site to display some pretty extensive content. 我目前在Shopify网站上使用手风琴来显示一些相当广泛的内容。 You can see a demo of what I'm using here: http://www.snyderplace.com/demos/accordion.html 您可以在这里看到我正在使用的演示: http : //www.snyderplace.com/demos/accordion.html

I'm wanting to be able to create a link on my webpage that will take the customer to, say the 3rd panel of the accordion OPEN, but I just can't figure out what JS I need to be using to do this! 我希望能够在我的网页上创建一个链接,该链接将把客户带到手风琴OPEN的第3个面板,但我只是想不通我需要使用哪种JS! Can someone help! 有人可以帮忙! Please? 请?

First thing that comes to my mind is passing aa meaningless # along with the link, like you would be going to a anchor. 我想到的第一件事就是传递一个毫无意义的#和链接,就像您要成为锚点一样。 Then on page load check to see if the URL contains the hashtag, if true trigger the panel you want to open. 然后在页面加载时检查URL是否包含井号,如果为true,则触发要打开的面板。

Link on initial page: 初始页面上的链接:

<a href="/newpag#panel-3" >link</a>

jQuery: jQuery的:

if(window.location.href.indexOf('#panel-3')){
   $('.thirdSection').trigger('click')}

I haven't tested this at all but with a bit of tweaking it should do the trick. 我根本没有测试过,但是稍作调整就可以解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM