您好,我在我的網站上遇到了jquery問題。它工作正常,直到我創建了一個使用jQuery的插件。我排隊的腳本:關於WordPress運行網站的jquery問題
wp_enqueue_style("nstdt","***/wp-content/plugins/***/css/nstdt.css");
wp_enqueue_style("pagecss","***/wp-content/plugins/***/css/jPaginator.css");
wp_enqueue_script("nstdt","***/wp-content/plugins/***/js/nstdt.js",array("jquery"));
wp_enqueue_script("paginate","***/wp-content/plugins/***/js/jPaginator.js",array("jquery","jquery-ui-core","jquery-ui-slider"));
的*只是模糊的網站的網址。
nstdt.js是我寫的jQuery,而jPaginator.js是我上網的腳本。
ndtdt啓動與此:
jQuery.noConflict();
jQuery(document).ready(function($){
和jPaginator.js開始,如:
(function($) {
$.fn.jPaginator = function(o) {
本身有一個小腳本運行在所謂的header.php迂迴這個主題
<?php wp_enqueue_script('jquery'); ?>
<script type="text/javascript">
var $j = jQuery.noConflict();
$j(document).ready(function() {
var interval;
這些是我得到的錯誤:
jQuery is not defined
Line 7
You must use this plugin with a unique element
***/wp-includes/js/jquery/jquery.js?ver=1.7.1
Line 2
獨特的元素事情看起來似乎是從jPaginator一個錯誤,因爲這是在第一行代碼:
if (this.size() != 1)
$.error('You must use this plugin with a unique element');
所以我想知道如果任何人有任何想法。是的,我通過螢火蟲檢查網站和jquery加載,並且是第一件加載。沒有404錯誤。
我試圖採取這一行了以及沒有衝突,仍然存在問題 – Tempus35 2011-12-18 21:56:09
你是如何解決它的? – Vigrond 2011-12-20 00:12:53