![](/img/trans.png)
[英]Can't seem to figure out why my javascript isn't working in IE and Chrome
[英]Can't seem to figure out why the script isn't working
我似乎无法弄清楚为什么这个div幻灯片脚本不起作用:'
剧本:
$("#slideshow > div:gt(0)").hide();
setInterval(function() {
$('#slideshow > div:first')
.fadeOut(1000)
.next()
.fadeIn(1000)
.end()
.appendTo('#slideshow');
}, 3000);
的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>
这是该网站的链接: http : //www.pearsonaviation.com.au/new/
任何帮助将不胜感激,加油!
您没有页面上包含的jQuery
库。
因此,出现了许多错误消息。
转到此页面: http : //jquery.com/download/
下载jQuery js文件,将其托管在服务器上并在页面中进行引用,或者使用页面上指定的CDN之一。
您在控制台中分配了错误。 幻灯片取决于jquery-library,请尝试将其包括在内。
由于您在页面中使用了noConflict,因此全局范围中的$
不会指向jQuery库。 所以试试
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.