Created
August 27, 2013 15:37
-
-
Save xpander54/6355213 to your computer and use it in GitHub Desktop.
current page js
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
$(document).on("ready", checkUrl); | |
function checkUrl() | |
{ | |
currentSite = window.location.pathname, | |
trimmed = currentSite.split("/"); | |
$(".menu-list a.btn1").removeClass("active"); | |
console.log("class removed trimmed1= "+ trimmed[1]); | |
switch(trimmed[1]) | |
{ | |
case "sucursales": | |
{ | |
console.log("trim sucursales"); | |
$(".menu-list li:nth-child(4) > a.btn1").addClass("active"); | |
break; | |
} | |
case "products": | |
{ | |
console.log("trimm products"); | |
$(".menu-list li:nth-child(2) > a.btn1").addClass("active"); | |
break; | |
} | |
case "servicios": | |
{ | |
console.log("servicios"); | |
$(".menu-list li:nth-child(3) > a.btn1").addClass("active"); | |
break; | |
} | |
case "contacto": | |
{ | |
console.log(" trimm contacto"); | |
$(".menu-list li:nth-child(5) > a.btn1").addClass("active"); | |
break; | |
} | |
default: | |
{ | |
$(".menu-list li:nth-child(1) > a.btn1").addClass("active"); | |
console.log("default"); | |
break; | |
} | |
} | |
} | |
(function(){ | |
$('.menu1').on('click', '.btn2', function(evt) | |
{ | |
alert("btn2"); | |
evt.preventDefault(); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment