【发布时间】:2018-05-28 00:31:23
【问题描述】:
我有一个 wordpress 我有各种脚本。
我已在标题中加入我的 jquery 和 jquery-ui
wp_enqueue_script('jquery', 'https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js', null, null, false);
wp_enqueue_script('jquery-ui', 'https://code.jquery.com/ui/1.10.0/jquery-ui.min.js', null, null, false);
跟随我的脚本
wp_enqueue_script('scripts', 'https://eg1234.cloudfront.net/wp-content/scripts/scripts.js', ['jquery','jquery-ui'], '', true);
我还有延迟脚本功能,可以将defer="defer" onload src="..." 添加到我的所有脚本中
但是我收到一个错误Uncaught TypeError: $(...).accordion is not a function 这是我的脚本文件中并且依赖于 jquery-ui,我相信延迟脚本是在加载 jquery-ui 之后?
有什么帮助吗?
【问题讨论】:
标签: javascript jquery wordpress jquery-deferred