Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 142327

Zooming class added to all images in slider without checking if the 'li' is active

$
0
0

I have a problem with flexslider 2 and elevate zoom plus. I would like to zoom active image from the slider. I have to use this option, because I also use ACF in wordpress and only this one works as I want. Unfortunately code which I created doesn't work as it should

$(document).ready(function() {
    if ($('.flexslider .slides > li').hasClass('flex-active-slide')) {
    $('.flexslider .slides li img').addClass('zooming');
}
else
{
    $('.flexslider .slides li img').removeClass('zooming');
}
});
</script>

When the li has class which means that image is active, then I would like to add class to the image which has to be zoomed. Unfortunately it adds zooming class to all images in slider without checking if the li is active. What am I doing wrong?


Viewing all articles
Browse latest Browse all 142327

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>