Ausbau DIV mit jQuery

Habe ich dieses kleine Stückchen code, die in Aktion gesehen werden kann hier

http://jsfiddle.net/rullingen/GCXsq/1/

Was im Grunde dehnt div Höhe, wenn Sie schwebte über und Verträge, wenn nicht.
Im moment erweitert von 75px auf 300px. Ich möchte dies ändern, so dass es sich aus 75px Höhe passt, dass die Inhalte in den DIV. Ich habe versucht Einstellung der erweitern Wert 'auto' ist, aber dies scheint nicht gut zu funktionieren. Kann jemand mir einen Zeiger?

HTML

<div class="expand">
    <img src="http://rauanklassnikringing.com/wp-content/uploads/2010/11/carrot-imperator.jpg" alt="" />
</div>
<div class="expand">
    <img src="http://rauanklassnikringing.com/wp-content/uploads/2010/11/carrot-imperator.jpg" alt="" />
</div>

<div class="expand">
    <img src="http://rauanklassnikringing.com/wp-content/uploads/2010/11/carrot-imperator.jpg" alt="" />
</div>

<div class="expand">
    <img src="http://rauanklassnikringing.com/wp-content/uploads/2010/11/carrot-imperator.jpg" alt="" />
</div>

<div class="expand">
    <img src="http://rauanklassnikringing.com/wp-content/uploads/2010/11/carrot-imperator.jpg" alt="" />
</div>

Javascript

$('.expand').hover(function() {
    $(this).animate({
        height: '300px'
    }, 300);
},function() {
    $(this).animate({
        height: '75px'
    }, 300);
});

CSS

.expand {
    overflow: hidden;
    margin-bottom: 15px;
    height: 75px;
}
InformationsquelleAutor Alex Sadler | 2011-02-16
Schreibe einen Kommentar