jQuery工作在jsFiddle中,但不是在HTML中 [英] jQuery working in jsFiddle but not in html

查看:101
本文介绍了jQuery工作在jsFiddle中,但不是在HTML中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我觉得自己像一个完全白痴,我相信我只是迟到了...但我无法让这个工作。在jsFiddle它奇妙的工作,但是当我把它放在我的html文件上它不会。请帮忙!我不知道错误在哪里。先谢谢你!这里是我的html:

Hello I feel like a complete idiot, and I am sure I am just up to late... but I can not get this to work. On jsFiddle it works wonderfully but when I put it on my html document it does not. Please help! I do not know where the error is. Thank you in advance! Here is my html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" href="test-isla.css" type="text/css" />

</head>

<body>
<div id="back">
<div class="red" id="div1"></div>
<div class="red1" id="div2"></div>
<div class="red2" id="div3"></div>
</div>
<div id="content"><p>Body Content goes here!!</p></div>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        function startfade(){
        $("#div3").fadeIn(3000, function(){
            $(this).delay(2000).fadeOut();
            $("#div2").fadeIn(3000, function(){
                $(this).delay(2000).fadeOut();
                $("#div1").fadeIn(3000, function(){
                    $(this).delay(1000).fadeOut();
                });
        });
        });

        }
        setInterval(function() {
              startfade();
        }, 9000);   
        startfade();​
        });
</script>
</body>
</html>

以下是我想要在jsFiddle上实现的最终结果! http://jsfiddle.net/liveandream/TCCn8/46/

And here is the end result I want to achieve on jsFiddle, where it does work! http://jsfiddle.net/liveandream/TCCn8/46/

预先感谢您!

推荐答案

尝试[在jsFiddle中运行]然后使用来自 http://jsfiddle.net/draft/
的代码这会给你准确的jsFiddle上使用的代码。
这肯定会起作用。

Try to [Run] the fiddle in jsFiddle and then use code from http://jsfiddle.net/draft/ This will give you the exact code used on jsFiddle. This will definitely work.

这篇关于jQuery工作在jsFiddle中,但不是在HTML中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆