如何解决Wordpress 手风琴菜单无法正常工作
我有以下页面 https://german-academic-institute.eu/faqs/,其中包含 WPBakery 插件,页面中间有用于常见问题解答的手风琴菜单。所有这些菜单都被关闭,但由于某种原因,它们不是,当我点击它们时,关闭/打开它们的选项不起作用。我还测试了其他可折叠菜单,也发生了同样的事情。所以我认为它必须对 Jquery 做一些事情,但无法弄清楚。
我可以使用任何帮助
谢谢。
解决方法
开发工具和浏览器控制台是您的朋友。您可以通过右键单击页面并从显示的菜单中选择 Inspect/Inspect Element 来访问它(实际文本因浏览器而异)。在 Dev Tools 中,如果您单击 Console 选项卡,您将在浏览器中看到错误并可以试验脚本。请看这张图:
您已经正确地猜到问题出在 jQuery
上,因为您的页面尝试使用该变量名称访问 jQuery,但是,在您的情况下,jQuery 被称为 $
。
快速解决方法是在尝试使用变量之前创建变量:
var jQuery = $;
或在所有出现的地方用 jQuery
替换 $
。请注意解决方案的思考过程:
- 我查看了错误并发现变量丢失
- 我检查了变量是否被称为
$
而不是jQuery
- 根据所学的知识,我已经制定了计划并写了一个答案给你
datepicker
似乎阻止了手风琴功能可用。
我什至找不到与手风琴功能相关的任何内容(就包含手风琴功能的实际脚本而言),但是在控制台中使用了一段时间后,我想出了这个丑陋的 jQuery - jQuery(".vc_tta-panel-heading a").click(function(e){e.preventDefault; jQuery(e.target).parents('.vc_tta-panel').children('.vc_tta-panel-body').toggle()})
。这是插件应该做什么。不完全是答案,但您可能会更幸运地联系插件作者寻求建议。
继续。
<!-- <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script> -->
you can update!
<script type="text/javacript">
//replace
jQuery( function() {
jQuery( "#datepicker" ).datepicker();
});
$(document).ready(function(){
//include you datepicker function.
})
</script>
<!-- Nice once -->
> note : is good practice include in section
> styles
> html sections
> tags lines javascript and includes
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。