开发者

Jquery problem slidedown

开发者 https://www.devze.com 2023-01-06 12:17 出处:网络
Hallo i have this script: <script type=\"text/javascript\"> function animateIt() { $(\".logo img\").slideUp(\"slow\")

Hallo i have this script:

<script type="text/javascript">

function animateIt() {
  $(".logo img").slideUp("slow")
}
animateIt();
</script>

When i use slideup. The image going away to the top. But i 开发者_开发百科wil use the slidedown. But when i change slide up to slideDown("slow"). My .logo img is not working? What do i wrong?


You have to wait for the dom to be ready:

<script type="text/javascript">

function animateIt() {
  $(".logo img").slideUp("slow")
}

//wait for the onload event:
$(animateIt);

</script>


why are you running this script before the document is ready? have you tried replacing animateIt(); with

 $(animateIt);
0

精彩评论

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

关注公众号