javascript - Active class not being applied when using 2 x 2 synced Owl Carousels -


I have 2 x 2 coded owl carousels on the same page demo, which can be seen here: < / P>

Now that I have 2 x 2 synchronized carousals, then I modified the code slightly with 2 of them.

However! The "minor-active" class is only being applied to the last carousel, even if I click in the carousel first.

You can see the full revised code of the link above: / P>

Remember! This is only the problem of active class! The 2 x 2 slideshow works perfectly in comparison to the fully active category which is not being applied to the slideshow first.

  // function indicates that two Oral Carousels Var sync1 = $ ("# sync1"); Var sync2 = $ ("# sync2"); Sync1.owlCarousel ({singleItem: true, slideSpeed: 1000, autoplay: 4000, Navigation: wrong, pagination: incorrect, post-action: sync, reservation refresh rate: 200,}); Sync2.owlCarousel ({itemsMobile: 4, item: 4, pagination: wrong, liability: refresh reset: 100, later: function (l) {el.find (".www.ww- item"). Eq (0) .addClass ("nav__item-active");}}); Function Sync (L) {var current = this.currentItem; $ ("# Sync2") appears ("owl-item.") RemoveClass ("nav__item - active") ... Eq (current) .addClass ("nav__item - active") if ($ ("# sync2") .data ("owlCarousel")! == undefined) {center (current)} $ $ ("# sync2"). ("Click on", ".owl-item", function (e) {e.preventDefault (); var number = $ (this) .data ("owluteum"); sink 1. trigger ("owl. ", Number);}); Function center (number) {var sync2visible = sync2.data ("owlCarousel"). Owl.visibleItems; Var num = number; Var found = false; For (sync2visible in var i) {if (num === sync2visible [i]) {var found = true; }} If (found === incorrect) {if (number> sync2visible [sync2visible.length -1]) {sync2.trigger ("owl.goTo", number - sync2visible.length +2)} else {if ( Number - 1 === -1) {num = 0; } Sync2.trigger ("owl.goTo", num); }} And if (num === sync2visible [sync2visible.length-1]) {sync2.trigger ("owl.goTo", sync2visible [1]) and if (num === sync2visible [0]) {sync2. Trigger ("owl.goTo", num-1)}} var sync3 = $ ("# sync3"); Var sync4 = $ ("# sync4"); Sync3.owlCarousel ({singleItem: true, slideSpeed: 1000, autoplay: 4000, Navigation: wrong, pagination: incorrect, post-action: sync, reservation refresh rate: 200,}); Sync4.owlCarousel ({itemsMobile: 6, item: 6, pagination: false, liability: refresh rate: 100, later: function (l) {el.find (".www.wind"). Eq (0) .addClass ("nav__item-active");}}); Function Sync (L) {var current = this.currentItem; $ ("# Sync4") .find ("owl-item.") .removeClass ("nav__item - active") .eq (current) .addClass ("nav__item - active") if ($ ("# sync4"). Data ("owlCarousel")! == Undefined) {center (current)}} $ ("# sync4"). On ("click", ".owl-item", function (e) {e.preventDefault (); var number = $ (this) .data ("owl etam"); ​​sink 3. transgeor ("owl. GO ", number);}); Function center (number) {var sync4visible = sync4.data ("owlCarousel"). Owl.visibleItems; Var num = number; var found = false; (Sync4visible in var i) {if (num === sync4visible [i]) {var found = true; }} If (found === incorrect) {if (number> sync4visible [sync4visible.length -1]) {sync4.trigger ("owl.goTo", number - sync4visible.length +2)} else {if ( Number - 1 === -1) {num = 0; } Sync4.trigger ("owl.goTo", num); }} And if (num === sync4visible [sync4visible.length-1]) {sync4.trigger ("owl.goTo", sync4visible [1]) and if (num === sync4visible [0]) {sync4. Trigger ("owl.goTo", num-1)}}   

Thanks a lot! : D

I got my answer: D

This is actually a bad idea 2x2 is almost the same Javascript functions by the same name, so they overwrite each other: P people at just 2 heads, call Sync Pozzo 1 and Center 1 :) < / html>

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -