2017-02-02 6 views
0

ich eine ähnliche Frage Adding flex-active class to the li instead of a/img gefundenhinzufügen flex-aktive Klasse li dann entfernen, wenn Schieber rücken

aber diese Lösung ist die Flex-aktive Klasse von dem aktiven li Geschwister nicht zu entfernen.

Ich werde nach dem Code als auch für referense

$('.flexslider').flexslider({ 
animation: "slide", 
directionNav: false, 
controlNav: "thumbnails", 
start: function(){ 
$('.flex-control-nav .flex-active').parent('li').addClass('flex-active').siblings().removeClass('flex‌​-active'); 
}, 
after: function(){ 
$('.flex-control-nav .flex-active').parent('li').addClass('flex-active').siblings().removeClass('flex‌​-active'); 
} 
}); 

jede Hilfe wäre toll!

Antwort

0

fand ich diese Lösung und die für mich


start: function() { 
     //-- Add flexslider active class to li of nav control instead of just on the image 
     if ($('.testimonial-section .flexslider ol.flex-control-nav').length > 0) { 
      // initial check and addition 
      $('.testimonial-section .flexslider ol.flex-control-nav li').each(function() { 
       if ($(this).children('img').hasClass('flex-active')) { 
        $(this).children('img').removeClass('flex-active'); 
        $(this).addClass('flex-active'); 
       } else { 
        $(this).removeClass('flex-active'); 
       } 
      }); 
      // bind into flexslider callback and run dynamically 
      $('.testimonial-section .flexslider').bind('start', function(event, slider) { 
       $('.testimonial-section .flexslider ol.flex-control-nav li').each(function() { 
        if ($(this).children('img').hasClass('flex-active')) { 
         $(this).children('img').removeClass('flex-active'); 
         $(this).addClass('flex-active'); 
        } else { 
         $(this).removeClass('flex-active'); 
        } 
       }); 
      }); 
     } 
    }, 
    after: function() { 
     //-- Add flexslider active class to li of nav control instead of just on the image 
     if ($('.testimonial-section .flexslider ol.flex-control-nav').length > 0) { 
      // initial check and addition 
      $('.testimonial-section .flexslider ol.flex-control-nav li').each(function() { 
       if ($(this).children('img').hasClass('flex-active')) { 
        $(this).children('img').removeClass('flex-active'); 
        $(this).addClass('flex-active'); 
       } else { 
        $(this).removeClass('flex-active'); 
       } 
      }); 
      // bind into flexslider callback and run dynamically 
      $('.testimonial-section .flexslider').bind('after', function(event, slider) { 
       $('.testimonial-section .flexslider ol.flex-control-nav li').each(function() { 
        if ($(this).children('img').hasClass('flex-active')) { 
         $(this).children('img').removeClass('flex-active'); 
         $(this).addClass('flex-active'); 
        } else { 
         $(this).removeClass('flex-active'); 
        } 
       }); 
      }); 
     } 
    } 
gearbeitet
Verwandte Themen