我正在尝试将我的页脚常见问题链接到另一页上的特定手风琴面板。所以基本上我只想让我的页脚常见问题链接打开它在faq页面上绑定的问题。
HTML(页脚链接):
<div class="footer-faq">
<a id="faq-link-1" href="http://accesshealth.lunabyte.io/faqs/#my
accordion">What is Access
Health?</a><br />
<a id="faq-link-2" href="http://accesshealth.lunabyte.io/faqs/#my-
accordion">Who are the Access Health clinicians?</a><br />
<a id="faq-link-3"
onclick="thing2();"href="http://accesshealth.lunabyte.io/faqs/#my-
accordion"> Does it matter where my insurance cover is?</a><br />
<a id="faq-link-4" onclick="thing3();"
href="http://accesshealth.lunabyte.io/faqs/#my-accordion"> Who can be
treated at Access Health?</a><br />
<a id="faq-link-5" onclick="thing4();"
href="http://accesshealth.lunabyte.io/faqs/#my-accordion"> Which conditions
are treated at Access Health?</a><br />
<a id="faq-link-6" onclick="thing5();"
href="http://accesshealth.lunabyte.io/faqs/#my-accordion"> What preventative
services are provided?</a><br />
<a id="view-all" href="http://accesshealth.lunabyte.io/faqs/">View All</a>
</div>
所以当我点击这些链接中的任何一个时,它只会打开手风琴中的第二个面板。所以它在某种程度上有效,但每个链接只打开第二个面板。
这是jQuery:
<script>
jQuery(function thing($){
$(window).load(function(){
if(window.location.hash) {
$( '.et_pb_accordion_item_0 .et_pb_toggle_title').click();
}
});
});
jQuery(function thing1($){
$(window).load(function(){
if(window.location.hash) {
$( '.et_pb_accordion_item_1 .et_pb_toggle_title').click();
}
});
});
jQuery(function thing2($){
$(window).load(function(){
var et_hash = window.location.hash;
if(window.location.hash) {
$( '.et_pb_accordion_item_2 .et_pb_toggle_title').click();
}
});
});
jQuery(function thing3($){
$(window).load(function(){
var et_hash = window.location.hash;
if(window.location.hash) {
$( '.et_pb_accordion_item_3 .et_pb_toggle_title').click();
}
});
});
jQuery(function thing4($){
$(window).load(function(){
var et_hash = window.location.hash;
if(window.location.hash) {
$( '.et_pb_accordion_item_4 .et_pb_toggle_title').click();
}
});
});
jQuery(function thing5($){
$(window).load(function(){
var et_hash = window.location.hash;
if(window.location.hash) {
$( '.et_pb_accordion_item_5 .et_pb_toggle_title').click();
}
});
});
</script>
答案 0 :(得分:0)
您可以在下面的解决方案中使用所有功能
$('.et_pb_accordion_item_4').children('.et_pb_toggle_title').click();
请检查此解决方案。