简体   繁体   English

似乎无法弄清楚该脚本为何不起作用

[英]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.

相关问题 似乎无法弄清楚为什么我的JavaScript无法在IE和Chrome中运行 - Can't seem to figure out why my javascript isn't working in IE and Chrome 无法弄清楚为什么JS插件无法正常工作 - Can't figure out why JS plugin isn't working 无法弄清楚为什么它不起作用了 - Can't figure out why it isn't working, anymore 我的javascript函数似乎无法正常工作。 我不知道为什么 - My javascript function doesn't seem to be working. I can't figure out why wp_add_inline_script没有向我的页面添加任何内容,无法弄清原因 - wp_add_inline_script isn't adding anything to my page, can't figure out why 我不知道为什么我的石头,剪刀布游戏中的得分不起作用 - I can't figure out why the scoring isn't working in my rock, paper, scissors game 无法弄清楚为什么它不起作用。 javascript调用数据键 - Can't figure out why it isn't working. javascript calling data-key 无法弄清楚为什么javascript无法在我的php文件中工作 - Can't figure out why javascript isn't working in my php file 我无法弄清楚为什么我添加事件处理程序的简单尝试无效 - I can't figure out why my simple attempt at adding an event handler isn't working 经典的元音练习。 我不知道为什么我的for循环无法正常工作 - classic vowel exercise. I can't figure out why my for loop isn't working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM