Here is my (simplified) situation:
http://jsfiddle.net/qFhaq/
Clicking the button launches an animation that expands the height of the div. While the div is expanding, the :after
pseudo-element (containing the text 'look') disappears and then reappears at the end of the animation.
Is there a way to prevent the pseudo-element from disappearing, so that it's visible throughout the animation?
Add "overflow" CSS rule to #main and set it to "visible !important;"
#main{
width: 200px;
height: 200px;
background-color: #eee;
border: 1px solid black;
overflow:visible !important;
}
I rewrite it that it used CSS3 transition:
JS (for fast, for better you can change it to vanilla js):
$(function(){
$("#clicky").click(function(){
$("#main").addClass('animate');
});
});
CSS:
#main{
width: 200px;
height: 200px;
background-color: #eee;
border: 1px solid black;
-webkit-transition: height 2s linear;
}
#main:after{
content: "look";
height: 50px;
background-color: white;
margin-left: 210px;
border: 1px solid black;
}
#main.animate{
height: 500px;
}
http://jsfiddle.net/qFhaq/1/
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