adding active class to topbar menu items since they are custom
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 6 Nov 2017 21:10:37 +0000 (16:10 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 6 Nov 2017 21:10:37 +0000 (16:10 -0500)
using js to determine which topbar page is currently active to apply the active class
to it

js/app.js
js/custom/pageSetup.js

index 87c2307..514885b 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -35,12 +35,19 @@ $(document).ready(function () {
     });
     var headerVideo = document.getElementById('front-page-video');
 
-    // if (headerVideo) {
-    //     headerVideo.play();
-    // }
-  
     if($(window).width() > 1024){
         $(headerVideo).attr("controls",false); 
-        console.log(Modernizr);
     }
+
+    var loc = window.location.href; // returns the full URL
+    if(/regions/.test(loc)) {
+        $('#interactive-map > li').addClass('active');
+    }
+    if(/destinations/.test(loc)) {
+        $('#dropdown-destination > li').addClass('active');
+    }
+    if(/venues/.test(loc)) {
+        $('#dropdown-venues > li').addClass('active');
+    }
+
 });
index c359dcf..0eacdaa 100644 (file)
@@ -26,12 +26,19 @@ $(document).ready(function () {
     });
     var headerVideo = document.getElementById('front-page-video');
 
-    // if (headerVideo) {
-    //     headerVideo.play();
-    // }
-  
     if($(window).width() > 1024){
         $(headerVideo).attr("controls",false); 
-        console.log(Modernizr);
     }
+
+    var loc = window.location.href; // returns the full URL
+    if(/regions/.test(loc)) {
+        $('#interactive-map > li').addClass('active');
+    }
+    if(/destinations/.test(loc)) {
+        $('#dropdown-destination > li').addClass('active');
+    }
+    if(/venues/.test(loc)) {
+        $('#dropdown-venues > li').addClass('active');
+    }
+
 });