Tuesday, 26 December 2017

How to change menu or tabs dynamic bases on URL

$(document).ready(function(){
  console.log("test1")
// following commented line take running url or (active)site name but i set  hard coded   for demo
  //var getCountryPath = window.location.host.split(".")[0];
  var getCountryPath="om";
  if(getCountryPath == "in"){
   
      $("li").removeClass("active");
      $("li > a[href='#india']").parent().addClass("active");
      $("#india").addClass("active");
    }
    if(getCountryPath == "qa"){
      $("li").removeClass("active");
      $("li > a[href='#qatar']").parent().addClass("active");
      $("#qatar").addClass("active");
    }
    if(getCountryPath == "om"){
      $("li").removeClass("active");
      $("li > a[href='#oman']").parent().addClass("active");
      $("#oman").addClass("active");
    }
    if(getCountryPath == "uae"){
      $("li").removeClass("active");
      $("li > a[href='#uae']").parent().addClass("active");
      $("#uae").addClass("active");
    }
    var hide = function (elem) {
    elem.classList.remove('is-visible');
};
});

No comments:

Post a Comment

Django rest api - filter

views.py from django_filters.rest_framework import DjangoFilterBackend class PollList(viewsets.ModelViewSet):     queryset = X.objects...