tags:

views:

28

answers:

1

Hi, is it possible to animate -> css('height','auto') ?

working example http://www.jsfiddle.net/V9Euk/154/

CSS

#div1 {
    position:absolute;
    right:30px;
    bottom:0px;
    border:1px solid #ff0000;
    overflow:hidden;
}

html

   <div id="div1" style="height:20px;">
        Test<hr />
        text text <br />
        text text <br />
        text text <br />            
    </div>

jquery

$("#div1").hover(

function() {

    $('#div1').animate({
        "height": "auto"
    }, "fast");                  // <---- dont work :(

}, function() {

    $('#div1').animate({
        "height": "20px"
    }, "fast");
});

Thanks in advance! Peter

A: 

Try if this helps:

$('#div1').removeClass("someClassWithYourHeight", "fast");

height should be auto per default, so if you just remove height it should be the same. You need the removeClass from UI Effects: http://docs.jquery.com/UI/Effects/removeClass

Just tested it - it works.

lasseespeholt
Wait, what? When did `removeClass()` get a duration parameter?
Yi Jiang
http://docs.jquery.com/UI/Effects/removeClass Oops, it should be UI-Effects, thanks
lasseespeholt
Thanks for your help! I use the soultion with jquery ui slide. Works great!
Peter
I'm happy to hear that :) best regards...
lasseespeholt
@Peter make an answer with the solution you got and accept that (or an answer from Yi Jiang which provided you with the right info).
lasseespeholt