1

I am trying to display content on click of a Flexslider slide title. Obviously there are many slides and each has its own title and description. I have the first show/hide toggle working properly. The others will not do anything.

$('a.toggle').bind('tapone',function(e){
  if($(this).hasClass('active')){
    $(this).removeClass('active');
$('#capinfo').slideUp({duration: 300, easing: "easeOutQuad"});
 } else {
     $(this).addClass('active');
     $('#capinfo').slideDown({duration: 300, easing: "easeOutQuad"});
   }
});

Here are the Flexslider list-items:

<li>
  <div class="flex-caption">
    <a class="toggle">
        <h3 class="caps">A Project Title</h3>
    </a>
    <div id="capinfo" class="caption-content">
       <p>Captions and cupcakes. Winning combination.</p>
    </div>

    </div>
    <img src="img/1994.jpg"/> 
</li>
4

1 回答 1

0

您可能希望改为针对该类.caption-content

$('a.toggle').bind('tapone',function(e){
    if($(this).hasClass('active')){
         $(this).removeClass('active');
         $('.caption-content').slideUp({duration: 300, easing: "easeOutQuad"});
    } else {
         $(this).addClass('active');
         $('.caption-content').slideDown({duration: 300, easing: "easeOutQuad"});
    }
});
于 2013-11-14T16:42:59.803 回答