alookatommorow/children-of-mex

View on GitHub
app/assets/javascripts/modules/nav.js

Summary

Maintainability
A
0 mins
Test Coverage
document.addEventListener("turbolinks:load", function() {
  var pageIndex = {
    "/contact": "Contact",
    "/apply": "Apply",
    "/": "Home",
    "/faq": "FAQ",
    "/about": "About",
    "/gallery": "Gallery",
    "/news": "News/Events",
    "/testimonials": "Testimonials"
  },
  pageTitle = pageIndex[window.location.pathname];

  $("a:contains("+pageTitle+")").addClass("active");

  /// toggle nav menu caret display ////
  $("#show-menu").click(function() {
    if(window.innerWidth <= 600) {
      $(".fa-caret-down").toggle();
      $(".fa-caret-up").toggle();
    }
  })
});