javascript - Jquery animate function not working - Stack Overflow

I'm using the following javascript to animate a div, but the div isn't animating... does anyo

I'm using the following javascript to animate a div, but the div isn't animating... does anyone know what can be?

JavaScript:

 <script language="JavaScript">   
    $(document).ready(function(){
    $('#LayoutDiv1').animate({top: "500px"}, 1500); }); 
    </script>

HTML:

<div id="LayoutDiv1">
    <img src="images/logo.png">
</div>

CSS:

#LayoutDiv1 {
    clear: both;
    float: left;
    width: 100%;
    display: block;
}

I'm using the following javascript to animate a div, but the div isn't animating... does anyone know what can be?

JavaScript:

 <script language="JavaScript">   
    $(document).ready(function(){
    $('#LayoutDiv1').animate({top: "500px"}, 1500); }); 
    </script>

HTML:

<div id="LayoutDiv1">
    <img src="images/logo.png">
</div>

CSS:

#LayoutDiv1 {
    clear: both;
    float: left;
    width: 100%;
    display: block;
}
Share Improve this question edited Aug 6, 2012 at 17:02 Wilson Junior asked Aug 6, 2012 at 16:56 Wilson JuniorWilson Junior 572 silver badges6 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 7

Working Demo : http://jsfiddle/LRuZp/3/

The position property should be specified, when defining top, left, bottom and right properties.

you need to set your div position to relative

#LayoutDiv1 {
    clear: both;
    float: left;
    width: 100%;
    display: block;

    position: relative

}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745638920a4637567.html

相关推荐

  • javascript - Jquery animate function not working - Stack Overflow

    I'm using the following javascript to animate a div, but the div isn't animating... does anyo

    6小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信