我正在嘗試在我的網站上實現simpleWeather.js。
不幸的是,當我把html的在我的網站,我得到
Uncaught TypeError: $.simpleWeather is not a function
我在我的HTML頂部引用simpleWeather.js:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.simpleWeather/3.1.0/jquery.simpleWeather.min.js"></script>
它被加載在網站上:
它完美對codepen.io雖然:/任何想法?
編輯:
我完整的代碼看起來是這樣的:
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.simpleWeather/3.1.0/jquery.simpleWeather.min.js"></script>
<script type="text/javascript">
//copied javascript from codepen.io
</script>
<style type="text/css">
//copied css from codepen.io
</style>
//copied html from codepen.io
哪裏是關於您的jQuery腳本標記您的simpleweather腳本標籤? (他們必須是這樣的順序:jQuery第一,然後是簡單的天氣。) –
我認爲你正在試圖在插件加載之前調用'simpleWeather' ... –
'jquery.min.js'引用就在'jquery之上。 simpleWeather.min.js'。我做了一切,如在codepen.io示例中:/ –