From 1deb23b82d18875bf481ea880172b3a2caf5a9cb Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Fri, 30 Mar 2012 16:42:54 +0100 Subject: [PATCH] Added toggleClass method --- js/Utils.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/js/Utils.js b/js/Utils.js index 876640fa3..abfe50633 100755 --- a/js/Utils.js +++ b/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); + } +} + })();