From 5c4f4aacb88143acbddbd815be77a0d0c7c4e08c Mon Sep 17 00:00:00 2001 From: phucbm Date: Fri, 29 Sep 2023 11:48:56 +0700 Subject: [PATCH] fix: use activeClass from options to allow customize --- src/helpers.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/helpers.js b/src/helpers.js index f858a74..2ae2603 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -1,5 +1,4 @@ import {arrayUnique} from "./utils"; -import {CLASSES, ATTRS} from './configs' /** * Has valid id @@ -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)); } @@ -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){