Skip to content

Instantly share code, notes, and snippets.

@xpander54
Created August 27, 2013 15:37
Show Gist options
  • Save xpander54/6355213 to your computer and use it in GitHub Desktop.
Save xpander54/6355213 to your computer and use it in GitHub Desktop.
current page js
$(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