Hope you all have a great day.
I want to add animation to this piece of code. I tried using animate (). But this did not work, maybe due to the lack of my knowledge in javascript.
Please tell me with this code, or do I need to try something else? What are you offering?
Thank you in advance.
Here is the HTML code:
<div id="description_wrapper"> Text content.<br/> See; More Text content. </div> <button class="learn_more" id="lm_more" href="#">Learn more</button>
CSS
#description_wrapper { margin: 0 auto; margin-top: 25px; height: 0; overflow: hidden; }
jQuery
$('#lm_more').click(function(event){ event.preventDefault(); if($('#description_wrapper').css('height') > '1px') { $('#description_wrapper').css({'height': '0px'}); $('#lm_more').html('Learn More'); } else { $('#description_wrapper').css({'height': 'auto'}); $('#lm_more').html('Learn less'); } });
Check out the code here http://jsfiddle.net/Gbspx/11/
source share