jquery: animate function problem

Posted by Syom on Stack Overflow See other posts from Stack Overflow or by Syom
Published on 2010-05-06T11:37:39Z Indexed on 2010/05/06 11:58 UTC
Read the original article Hit count: 141

Filed under:

i start learning jquery just yesterday. i have a div element with some content, and i want to hide it by changing it's height: here is the script

 <script type="text/javascript">
    $(document).ready(function(){
        $("#hide").click(function(){
            $("#cont").animate({
                height: '0'
                },1500);
            $("#cont").hide();
        });
    });
    </script>

<input type="button" value="hide" id="hide">
<div  id="cont">
text here...
</div>

but it doesn't work, becouse it automaticaly sets display:block to #cont element, so after animation it starts to show. when i try to set display:none to #cont element, it doesn't happen. could you help me? thanks

© Stack Overflow or respective owner

Related posts about jQuery