所以当我使用bgstretcher时出现错误,所有链接都是正确的脚本,并且它适用于演示网站,我试图从index.php文件中删除所有其他脚本,但仍然得到相同的错误 - 未捕获的TypeError:Object [object Object]没有方法'bgStretcher' 所以这是代码 -
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>STANDBY Countdown Script</title>
<link rel="stylesheet" type="text/css" href="css/jcountdown-style.css" />
<link rel="stylesheet" type="text/css" href="css/standby-style.css" />
<link rel="stylesheet" href="css/bgstretcher.css" />
<script src="script/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="script/bgstretcher.js" type="text/javscript"></script>
<script src="script/jquery.jcountdown1.3.3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
// Initialize Backgound Stretcher
$('body').bgStretcher({
images: ['demo/images/sample-1.jpg', 'demo/images/sample-2.jpg', 'demo/images/sample-3.jpg', 'demo/images/sample-4.jpg', 'demo/images/sample-5.jpg', 'demo/images/sample-6.jpg'],
imageWidth: 1024,
imageHeight: 768,
slideDirection: 'N',
slideShowSpeed: 3000,
transitionEffect: 'fade',
sequenceMode: 'normal',
});
});
</script>
<script type="text/javascript">
$(document).ready(function() {
$("#time").countdown({
date: "January 31, 2013", /* Counting to a date */
offset: 1,
hoursOnly: false,
leadingZero: true
});
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
if (input.val() == '' || input.val() == input.attr('placeholder')) {
input.addClass('placeholder');
input.val(input.attr('placeholder'));
}
}).blur();
});
</script>
</head>
此外没有JS / HTML代码,所以我仍然不确定,问题是什么,为什么我会收到错误?
答案 0 :(得分:1)
在您的代码第12行中,您拼错了javascript,这会阻止加载bgstretcher.js
文件。变化:
<script src="script/bgstretcher.js" type="text/javscript"></script>
为:
<script src="script/bgstretcher.js" type="text/javascript"></script>
答案 1 :(得分:0)
尝试删除'normal'后的逗号
所以
sequenceMode: 'normal',
变为
sequenceMode: 'normal'