私のコードにbackstretch
を追加します。私たちは、このHTMLページを開くとイメージを動的に変更したい
<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>
:
これはスクリプトです。しかし、それは言っている
Uncaught type error. $backstretch is not a function.
我々はそれを含めることができますか?または、画像を動的に変更する他の方法はありますか?
なぜjqueryを複数回組み込んだのですか?他のjsファイルの一番上に一度だけ含めてください。 –