Skip to content

Commit

Permalink
fix: use activeClass from options to allow customize
Browse files Browse the repository at this point in the history
  • Loading branch information
phucbm committed Sep 29, 2023
1 parent 9a3154b commit 5c4f4aa
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {arrayUnique} from "./utils";
import {CLASSES, ATTRS} from './configs'

/**
* Has valid id
Expand Down Expand Up @@ -166,8 +165,8 @@ export function removeActiveClass(context, id){
const {current, currentTrigger} = getElements(context, id);

// update classes
current.forEach(item => item.classList.remove(CLASSES.active));
currentTrigger.forEach(item => item.classList.remove(CLASSES.active));
current.forEach(item => item.classList.remove(context.options.activeClass));
currentTrigger.forEach(item => item.classList.remove(context.options.activeClass));
}


Expand All @@ -181,8 +180,8 @@ export function addActiveClass(context, id){
const {current, currentTrigger} = getElements(context, id ? id : context.current_id);

// update classes
if(current) current.forEach(item => item.classList.add(CLASSES.active));
if(currentTrigger) currentTrigger.forEach(item => item.classList.add(CLASSES.active));
if(current) current.forEach(item => item.classList.add(context.options.activeClass));
if(currentTrigger) currentTrigger.forEach(item => item.classList.add(context.options.activeClass));
}

export function log(context, status, ...message){
Expand Down

0 comments on commit 5c4f4aa

Please sign in to comment.