Skip to content

Instantly share code, notes, and snippets.

@howellcc
Last active March 11, 2016 22:28
Show Gist options
  • Save howellcc/c29e3418764d88cb421e to your computer and use it in GitHub Desktop.
Save howellcc/c29e3418764d88cb421e to your computer and use it in GitHub Desktop.
[MuraCMS] An efficient way to cache nav
/*Mura Nav Caching.
Set the nav caching to only cache 1 copy (no attaching an ID to the key)
Then put this in the javascript
*/
//Active class for mobile nav - This is done so that we can cache the mobile nav once and apply the active class after rendering
activeID = $('body').attr('class').replace(/^sys/,'nav');
$('#'+activeID).addClass('active');
$('#'+activeID).parents('li').addClass('active');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment