简体   繁体   English

这个 jQuery 代码有什么问题?

[英]What's wrong with this jQuery code?

I have about 50 lines of JQuery on my site.我的网站上有大约 50 行 JQuery 。 When I add this line当我添加这一行

var img1 = "url('/wp-content/themes/thesis_18/custom/images/map.jpg') repeat";
$(".submit").click(function(){

     $("body.custom").css({background: img1});

    });

it still works fine, but when I add the following long list of elements (see below) with this css.fadeOut(1000) it breaks all the jQuery on my site.它仍然可以正常工作,但是当我使用此 css.fadeOut(1000) 添加以下一长串元素(见下文)时,它会破坏我网站上的所有 jQuery。 I don't see what's wrong with that new line and, indeed, I tested the simple idea in a fiddle http://jsfiddle.net/mjmitche/FBnrR/6/我看不出那条新线有什么问题,实际上,我在小提琴http://jsfiddle.net/mjmitche/FBnrR/6/中测试了这个简单的想法

Do you see what's wrong with this code below that it's stopping everything on my site?您是否看到下面这段代码有什么问题,它阻止了我网站上的所有内容?

$(".submit").click(function(){
     $("#topnav4, #cloud1, #cloud2, #cloud3, #cloud4, #cloud5, #cloud6, 
       #intro1, #intro2, #contactform").fadeOut(1000)
     $("body.custom").css({background: img1});

    });

You miss a ";"你错过了一个“;” at the end of fadeOut() !!在 fadeOut() 结束时!!

In fiddle, you have JSLint button to verify javascript code...在小提琴中,您有 JSLint 按钮来验证 javascript 代码...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM