![](/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.