Search code examples
javascriptjqueryowl-carousel

never remove active class in jQuery


I added a class on my specific button, the button is on the slider, when I clicking the arrow of slider, the slider automatically adding active class to another button, I want to write some method which will never remove a class of my specific button how can I do it?

this is the code which is adding active class

($(item).parent('.owl-stage').parent('.owl-stage-outer').parent('.img-block').children('.owl-dots').children('button').not('.displayed-slider-btn')[2]).addClass('active');

Solution

  • Just use another class. Class "active" is used by Owl plugin, you can not disable it without crashing the source code. For ex. add specific class "enabled" and copy for it all css style from class "active"