jquery - 可能的 Jquery 冲突或只是损坏的脚本?

标签 jquery css wordpress jquery-ui-accordion

我在 Wordpress 站点中有一个 Accordion div,它以前可以工作,但现在不能了。我停用了所有插件,但这似乎无济于事。我仔细检查以验证我的 css 标记,但没有发现任何损坏的东西,尽管我可能遗漏了什么?我也没有发现任何 jquery 冲突,但也许此时我的大脑只是被炸了。

这是我的脚本:

<script type="text/javascript">
		$(document).ready(function($) {
			$('#accordion').find('.accordion-toggle').click(function(){
	
				//Expand or collapse this panel
				$(this).next().slideToggle('slow');
	
				//Hide the other panels
				$(".accordion-content").not($(this).next()).slideUp('slow');
	
			});
		});
	</script>

这是 html:

<div class="testimonials">
<h3 style="margin-bottom:0px;">TESTIMONIALS</h3>
</div>
<div class="accordion-wrap">
<div id="accordion">
  <span class="accordion-toggle">Blah Blah Blah 
<div class="rmore">READ MORE +</div>
<p>&nbsp;</p>
</span>
  <div class="accordion-content">
  <div class="accordion-content-wrap">
<p>
Blah Blah Blah 
</p>
<p>Blah Blah Blah 
</p>
<p>Blah Blah Blah 
</p> 
  </div>
  </div>
</div>
</div>

This is the site I am working on where it somehow broke.

最佳答案

尝试将这些脚本移动到文件末尾。您在第 19 ~ 62 行调用 jQuery 函数,但直到第 110 行才加载它。

enter image description here

关于jquery - 可能的 Jquery 冲突或只是损坏的脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30673206/

相关文章:

ASP.NET 使用 jQuery 访问当前 session

jquery - 删除按钮的悬停/单击状态

javascript - jQuery append() - 重复追加

mysql - 如何使用 WordPress 在卸载时删除表?

html - WordPress - 自定义存档页面

Jquery ui 对话框默认最大化

jQuery 布局管理器

javascript - 尝试在 Safari 上使用 insertAfter 移动标签时出现问题

html - CSS 背景图片未加载/损坏

mysql - WordPress 元值(序列化)过滤器