Following a book's code for slide up/down animation using anglularjs here is the example code: http://jsfiddle.net/bx01muha/2/
here is the css code:
.container {
overflow: hidden;
}
.slide-tile {
transition:all 0.5s ease-in-out;
width:300px;
text-align:center;
border: 1px solid black;
transform: translateY(0);
}
.slide-tile.ng-hide {
transform: translateY(-100%);
}
The problem is when the content is slide up/down the content under it moved up/down with a jerk. How to fix a css3 slide up/down so that the content under it also moves smoothly?
Why not use simple JavaScript/jQuery?
Here's my solution: http://codepen.io/n3ptun3/pen/EVJzPv/
It fixes the "jerky" issue, although it doesn't use Angular. Hope this helps!
HTML
<div>
<div>
<button>
Toggle Visibility
</button>
<div class="container">
<div class="slide slide-tile">
Slide me up and down! lets see whats going on...
</div>
</div>
<h1 class="slide">Jerky</h1>
</div>
</div>
CSS
.container {
overflow: hidden;
}
.slide-tile {
transition:all 0.5s ease-in-out;
width:300px;
text-align:center;
border: 1px solid black;
transform: translateY(0);
}
.hide {
transform: translateY(-100%);
}
h1 {
transition: all 0.5s ease-in-out;
}
JavaScript/jQuery
$(function(){
$("button").click(function(){
$(".slide").toggleClass("hide");
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With