$('.dropdown-menu').each(function() {
$(this).hover(function() {
$(this).parent('li').addClass('active');
});
$(this).mouseleave(function() {
var location = window.location.href;
var link = $(this).siblings('a').href; //undefined
console.log(location);
console.log(link); // undefined
if(location !== link) {
$(this).parents('li').removeClass('active');
}
});
});