- This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
Viewing 8 posts - 1 through 8 (of 8 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › jQuery won’t animate or expand
I’m having a hard time trying to get this to animate and expand. Any help?
Like this? http://codepen.io/Jarolin/pen/inmqK
the effect you are trying to achieve is if the user hovers a font the whole div disappears and only the selected font is vissible?
@Jarolin No.
Basically the `.gallery` has a fixed height due to the designed layout. I’m trying to expand the height by adding `overflow: visible;` and `height: auto;` to show the additional typefaces.
If it’s also possible with a jQuery like slideDown in CSS, I’d opt for that.
You can’t animate to auto height I think, you can use the height of the inner element:
$(‘.font-samples’).mouseenter(function() {
$(‘.gallery’).animate({
height: $(‘.list-item’).height() + ‘px’
});
});
@CrocoDillon Perfect! What about on `mouseleave`? I need it to go back to the default state.
With jQuery’s hover you can set both handlers:
$(…).hover(function() {
// enter
}, function() {
// leave
});
just put the original height back :)
@Crocodillon Thank you, sir!