Thursday, December 25, 2014

jQuery- Toggle Up and Dowm

 Toggle Up and Dowm


<div id="faq-list">
 <div class="overflow">
    <div class="to-bottom-border">
    <h2 class="ques">Click 1</h2>
    <div style="display:none;" class="answer">
     <p>Expanded 1</p>
     </div>        
     </div> 

<div class="to-bottom-border">
    <h2 class="ques">Click 2</h2>
    <div style="display:none;" class="answer">
     <p>Expanded 1 </p>
     </div>        
     </div>      
</div>
 </div>


 <script>
jQuery(document).ready(function() {
    jQuery('#faq-list h2').click(function() {
       
        jQuery(this).next('.answer').slideToggle(500);
       jQuery(this).toggleClass('close');
       
    });
}); // end ready
</script>

Note: Please be sure, jQuery libary has included for the page.

Njoy the day :) :)

No comments :

Post a Comment