2017-02-19 68 views
0

我在wordpress網站上安裝了visual composer。出於某種原因,當我isert和圖像或任何元素,並應用從視覺作曲家內部的動畫,頁面變爲空白,沒有顯示,沒有動畫,什麼都沒有。Visual Composer/jquery動畫無法正常工作調試錯誤

聯繫插件開發者後,他們說另一個插件是衝突的,但我只有1個插件安裝jetpack。我已經安裝並且問題依然存在。

使用調試工具,我得到以下錯誤。有任何想法嗎?

Uncaught TypeError: a.indexOf is not a function at r.fn.init.r.fn.load (jquery.min.js?ver=3.1.1:4) at waypoints.min.js?ver=5.0.1:8 at waypoints.min.js?ver=5.0.1:8 at waypoints.min.js?ver=5.0.1:8 at waypoints.min.js?ver=5.0.1:8

Uncaught TypeError: f.getClientRects is not a function at r.fn.init.offset (https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js?ver=3.1.1:4:20376) at t.refresh (http://####/wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:2072) at t. (http://#####/wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:6130) at Function.each (https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js?ver=3.1.1:2:2865) at refresh (http:#####/wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:6100) at Function.n.(anonymous function) [as waypoints] (http://###wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:7638) at r.fn.init.init (http://####/wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:4817) at r.fn.init.n.fn.(anonymous function) [as waypoint] (http://######/wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:5712) at function.window.vc_waypoints.window.vc_waypoints (http://####/wp-content/plugins/js_composer/assets/js/dist/js_composer_front.min.js?ver=5.0.1:1:7243)

回答

1

默認情況下,最新版本的WordPress使用jQuery版本1.12.4,但您的網站似乎是通過Google的CDN調用jQuery 3.1.1。 Visual Composer可能與jQuery 3尚不兼容。

如果這是網站上唯一的插件,那麼它可能是調用這個jQuery版本的主題。如果編碼正確,則應該能夠找到覆蓋jQuery版本的wp_register_scriptwp_enqueue_script函數。如果你用wp_enqueue_script('jquery');取代它,你會加載WordPress的jQuery,它可以解決這個問題。

三題:

  1. 主題可能有使用wp_deregister_script取代 jQuery的。你也需要評論一下。
  2. 更改jQuery版本可能會打破JavaScript來自您的主題,如果 js需要jQuery版本3,所以尋找這方面的問題。
  3. 當您更新主題時,它將恢復此更改。所以你應該考慮通過兒童主題來做到這一點,以保持更新的變化。
+0

您好,非常感謝您的回答,這使得SENCE爲我所做的更改WordPress的方式使用jQuery的功能! //製作jQuery的谷歌API 功能modify_jquery(){ \t如果(is_admin ()){ \t \t //註釋掉接下來的兩行來加載jQuery的本地副本 \t \t wp_deregister_script('jquery'); \t \t wp_register_script('jquery','https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js',false,'3.1.1'); \t \t wp_enqueue_script('jquery'); \t} } add_action('init','modify_jquery'); – user1673498

+0

謝謝刪除該功能解決了問題。 – user1673498

+0

如果你想使用CDN來達到速度/緩存的目的,你可以使用谷歌的jQuery版本。只要確保你使用的WordPress使用的是相同的jQuery。很高興我能幫上忙! –