我的页面上 div 内的链接有问题。目前,当点击链接时,没有任何反应。我不明白为什么,但我想这与在包含的 div 上使用 hide() 和 show() 有关,我将在下面解释。
div 是自定义“手风琴”的一部分,它使用以下 Jquery 在单击标题时打开/关闭正确的 div:
$('.accordion .head').click(function () {
$('.accordion .head').next().hide();
$('.accordion .head').removeClass("active");
$(this).next().show('fast');
$(this).addClass("active");
return false;
});
我知道有更好的方法来实现“手风琴”行为,但是因为我们的网站都使用了这种方法,所以我没有选择更新手风琴来使用实际的 Jquery 手风琴()方法,而不需要做很多额外的工作我。
那么,鉴于下面的示例代码,任何人都可以帮助我理解这里的问题是什么,或者如何克服它?
<div class="accordion">
<div class="head active"><a href="#">Heading 1</a></div>
<div class="accordion-content first">
<p>
Some text here
</p>
<div class="accordion-logos">
</div>
</div>
<div class="head"><a href="#">Heading 2</a></div>
<div class="accordion-content">
<p>
Some other text here
</p>
<p>
<a href="http://www.google.com">http://www.google.com</a>
</p>
</div>
</div>
当我专门处理它时,我什至无法点击注册,当点击链接时,下面代码中的警报永远不会触发:
$('.accordion .accordion-content #thelink').click(function () {
alert();
});
谢谢你,
玫瑰