我試圖把這些移動的雲:http://vintageskytheme.tumblr.com/(這是我已經從themeforest買了一個主題,但其tumblr)jQuery功能不移動...找不到任何錯誤嗎?
我試圖把它放在WordPress的。這裏:http://pawprintsinmypancakes.com/
它曾經是$()函數,我發現它每隔30毫秒在控制檯中給出錯誤,所以我知道代碼的其餘部分正在工作......但是當我將其更改爲jQuery()..控制檯只是沉默。我不知道什麼是錯
我試圖把這些移動的雲:http://vintageskytheme.tumblr.com/(這是我已經從themeforest買了一個主題,但其tumblr)jQuery功能不移動...找不到任何錯誤嗎?
我試圖把它放在WordPress的。這裏:http://pawprintsinmypancakes.com/
它曾經是$()函數,我發現它每隔30毫秒在控制檯中給出錯誤,所以我知道代碼的其餘部分正在工作......但是當我將其更改爲jQuery()..控制檯只是沉默。我不知道什麼是錯
兩兩件事:
1:更改下面的代碼:
//Set the CSS of the header.
jQuery('#head_interior').css("background-position", current + " bottom");
jQuery('#head_exterior').css("background-position", current2 + " bottom");
這樣:
//Set the CSS of the header.
jQuery('#head_interior').css("background-position", current + "px bottom");
jQuery('#head_exterior').css("background-position", current2 + "px bottom");
請注意「底部」之前添加的「px」。在設置CSS樣式時,你需要這些,因爲css允許px,em,pt等等。如果你不告訴它使用什麼單位,它會高興地忽略你的值。
這將讓你的雲移動。
2:您的$對象正在被覆蓋。不知道在哪裏。我也建議你換你的代碼中調用jQuery對象,就像這樣:
jQuery(function(){
// your existing code here
});
即用jQuery做的事情,這樣你就不會污染全局範圍的標準方法。
檢查了這一點:jQuery noConflict
+1如果內存服務,我相信原型已經使我在 –
之前使用這個,那麼我的代碼中的錯誤是什麼?我非常吮吸jquery,我甚至不知道如何使用它 – Tallboy
如果我不得不猜測你的'$'正在被其他一些JavaScript庫覆蓋。 – cspray