mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-24 02:27:19 +00:00
Added toggleClass method
This commit is contained in:
parent
ae78b97596
commit
1deb23b82d
11
js/Utils.js
11
js/Utils.js
@ -259,4 +259,15 @@ utils.removeClass = function(el,className) {
|
||||
}
|
||||
};
|
||||
|
||||
utils.toggleClass = function(el,className,status) {
|
||||
if(status === undefined) {
|
||||
status = !utils.hasClass(el,className);
|
||||
}
|
||||
if(status) {
|
||||
utils.addClass(el,className);
|
||||
} else {
|
||||
utils.removeClass(el,className);
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user