我想在我的代碼中添加backstretch
。
這是腳本:
<script>
// To attach Backstrech as the body's background
jquery.backstretch("/form-3/assets/img/backgrounds/1.jpg");
// You may also attach Backstretch to a block-level element
jquery.(".foo").backstretch("/form-3/assets/img/backgrounds/1.jpg");
// If your element defines a background image with CSS, you can omit the argement altogether
//$(".foo").backstretch();
// Or, to start a slideshow, just pass in an array of images
jquery.(".foo").backstretch([
"/form-3/assets/img/backgrounds/1.jpg",
"/form-3/assets/img/backgrounds/2.jpg",
"/form-3/assets/img/backgrounds/[email protected]"
], {duration: 4000});
</script>
//I have included the scripts here
<script src="/form-3/assets/js/jquery-1.11.1.min.js"></script>
<script src="/form-3/assets/js/jquery-1.11.1.js"></script>
<script src="/form-3/assets/bootstrap/js/bootstrap.min.js"></script>
<script src="/form-3/assets/js/jquery.backstretch.min.js"></script>
<script src="/form-3/assets/js/jquery.backstretch.js"></script>
<script src="/form-3/assets/js/scripts.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script>
我要動態地改變圖像爲我們打開該HTML頁面。但這是說
Uncaught type error. $backstretch is not a function.
我們如何包括它?或者有沒有其他方法可以動態改變圖片?
爲什麼你多次包含jquery?在其他js文件的頂部只包含一次。 –