Total articole: 1

Vezi toate editiile
$(function(){ function getURL(url) { name = url.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]').replace("&" , "&").replace("&" , "&"); return name; } // get URL value var query = getURL("Default.aspx?ID=6945"); var listOfLi = $("ul.pagination.pagination-sm li a"); // if the URL does not contains 'page' , make the first li active // if(query.indexOf("page") != 0) { // $("ul.pagination.pagination-sm li").eq(0).addClass("active"); // } else { // $("ul.pagination.pagination-sm li").eq(0).removeClass("active"); // } var firstTimeOnPage = _.includes(query , "page"); if(!firstTimeOnPage) { $("ul.pagination.pagination-sm li:first").addClass("active"); } // check if URL value is equal to any of li's URL value _.map(listOfLi , function(obj){ var liURL = $(obj).attr("href").replace("/" , ""); if(liURL == query) { $(obj).parent().addClass("active"); } }); });