[英]Can't seem to figure out why the script isn't working
I can't seem to figure out why this div slideshow script isn't working:' 我似乎无法弄清楚为什么这个div幻灯片脚本不起作用:'
The script: 剧本:
$("#slideshow > div:gt(0)").hide();
setInterval(function() {
$('#slideshow > div:first')
.fadeOut(1000)
.next()
.fadeIn(1000)
.end()
.appendTo('#slideshow');
}, 3000);
The html: 的HTML:
<div id="slideshow">
<div>
<img src="http://farm6.static.flickr.com/5224/5658667829_2bb7d42a9c_m.jpg">
</div>
<div>
<img src="http://farm6.static.flickr.com/5230/5638093881_a791e4f819_m.jpg">
</div>
<div>
Pretty cool eh? This slide is proof the content can be anything.
</div>
</div>
Here is the link to the site: http://www.pearsonaviation.com.au/new/ 这是该网站的链接: http : //www.pearsonaviation.com.au/new/
Any help would be really appreciated, cheers! 任何帮助将不胜感激,加油!
You do not have the jQuery
library included on the page. 您没有页面上包含的
jQuery
库。
Hence the sea of error messages. 因此,出现了许多错误消息。
Go to this page : http://jquery.com/download/ 转到此页面: http : //jquery.com/download/
Either download the jQuery js file, host it on your server and reference it in the page, or use one of the CDNs specified on the page. 下载jQuery js文件,将其托管在服务器上并在页面中进行引用,或者使用页面上指定的CDN之一。
You have allot of errors in console. 您在控制台中分配了错误。 Slideshow depends on jquery-library, try to include that first.
幻灯片取决于jquery-library,请尝试将其包括在内。
Since you have used noConflict in the page, $
in global scope does not point to jQuery library. 由于您在页面中使用了noConflict,因此全局范围中的
$
不会指向jQuery库。 So instead try 所以试试
jQuery(function($){
$("#slideshow > div:gt(0)").hide();
setInterval(function() {
$('#slideshow > div:first')
.fadeOut(1000)
.next()
.fadeIn(1000)
.end()
.appendTo('#slideshow');
}, 3000);
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.