我不擅長腳本,我無法弄清楚我的執行出了什麼問題。無法獲得Javascript文件在頁面上運行
該網頁是http://snmcsupport.com/map-js-test-page,它應該運行一個腳本來產生一個可點擊的地圖。腳本本身是非常長的,所以我不會在這裏貼,但你可以看到它if you click here
在我的網頁,我要運行腳本在頭
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">
</script>
<script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.4/raphael-min.js">
</script>
<script src="//cdnjs.cloudflare.com/ajax/libs/qtip2/2.1.1/jquery.qtip.min.js">
</script>
在必要的標記我網頁,我叫腳本
<div>
<script type="text/javascript" src="http://snmcsupport.com/wp-includes/js/app.js">
</script>
</div>
但我仍然無法獲得代碼運行?從開發商也初步說明說:
The last step is to initialize the map by making the following script calls:
<script>makeaClickableMap.initialize(<your-document-object-model-handle>);</script>
where your-object-document-model handle can be anything actually:
a jQuery object like $("#map")
a Javascript Document Object Model like document.getElementById("map")
or a simple string like "map"
,但我想不出是什麼意思。如果我嘗試在網頁中輸入初始化命令,我會遇到一個令人討厭的交叉腳本錯誤,它不會讓我知道。
我在使用Divi兒童主題的Wordpress上運行此操作。
如何使用WordPress jQuery文件和嵌入qtip和拉斐爾在兒童主題?你用wp_enqueue_script('jquery')正確排列你的js嗎? ... – Benoti
可能不是......該腳本的開發人員不直接與WP或Divi工作;我認爲他是在假定它直接嵌入到HTML中的情況下編寫的。我需要做整個字符串:wp_enqueue_script(string $ handle,string $ src ='',array $ deps = array(),string | bool | null $ ver = false,bool $ in_footer = false) –