开发者

jQuery .slideDown executes twice instead of once

I'm new to jquery and bumped into a problem i can't fix

I want that on pageload my content is sliding down so i use the next code:

  $(document).ready(function () {
    $("#content").hide();
    $("#content").slideDown(1000);
  });

when i lo开发者_运维知识库ad the page the content slides down narmally, than the content gets hidden and slides down again.

When i go to the css and do #content{display: none;} instead of $("#content").hide(); everything works fine. (can't use this for browsers without js)

Does anyone know the cause of this?

Thanks!


You are saying that everything works fine while using css #content{display: none;} than i offer u to use Jquery .css() method( http://api.jquery.com/css/ )..

u can use it like :

  $(document).ready(function () {
    $("#content").css( { 'display' : 'none' } );
    $("#content").slideDown(1000);
  });

sipmle as that.

and i also agree with @Billy Moon , it can be a browser specific bug or u may be calling a page refresh command, somewhere within ur code.


Your code has no problem inside. It's somewhere else in your code.

isn't that function call in some function that is called twice?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜