-
-
Save BlackSkorpio/f8ea86d60154064da2e87fc5bbc5620e to your computer and use it in GitHub Desktop.
add body class based on the url using RegEx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* add body class */ | |
var loc = window.location.pathname.match(/^\/?(\w+)\b/); | |
if(loc) $(document.body).addClass(loc[1].toLowerCase()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment