Created
November 20, 2012 16:12
-
-
Save mware/4118884 to your computer and use it in GitHub Desktop.
add body class based on the url using RegEx
This file contains 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