开发者

Jquery Fade In not working in Safari

开发者 https://www.devze.com 2023-02-22 10:17 出处:网络
I have a simple splash page that I want to fadeIn a single div.For some reason I can\'t get it to work in Safar开发者_运维问答i. In safari it only shows $(document).ready(function(){ and the image bel

I have a simple splash page that I want to fadeIn a single div. For some reason I can't get it to work in Safar开发者_运维问答i. In safari it only shows $(document).ready(function(){ and the image below but that is it, no effect.

Works fine in FF and Chrome.

$(document).ready(function(){
        $("#image").hide().fadeIn(3500)
});

Full Source below:

<!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>Sample</title>

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>


<style type="text/css">
<!--
#image {
  position: fixed;
  top: 50%;
  left: 50%;
  margin-top: -100px;
  margin-left: -300px;
} 
-->
</style>

<script type="text/javascript" />
    $(document).ready(function(){
            $("#image").hide().fadeIn(3500)
    });
</script>

</head>

<div id="image"><img src="14.png" alt="Sample" /></div>


<body>
</body>
</html>


<script type="text/javascript" />
    $(document).ready(function(){
            $("#image").hide().fadeIn(3500)
    });
</script>

Needs to be

<script type="text/javascript" >
    $(document).ready(function(){
            $("#image").hide().fadeIn(3500);
    });
</script>

You added extra '/' on the first line


Try chaining the events, similar to the following:

$(document).ready(function(){
        $("#image").hide('fast', function() {
             $(this).fadeIn(3500);     
        });
});
0

精彩评论

暂无评论...
验证码 换一张
取 消