I'm running a code that displays content based on the url. If the user is in page X, the page displays the content number 1 and hides number 2, if he's in page Y, it displays the content number 2 and hides number 1. It works, but I would like to add a second URL to be checked.
My code is as follows:
jQuery(document).ready(function($){
var url = document.location.href;
if(url == "http://w.com/") {
$(".banner1").show();
$(".adsenselistingtop").show();
$("#leheaderbanner").hide();
$("#showhide-in-home").hide();
} else {
$(".banner1").hide();
$(".adsenselistingtop").hide();
$("#leheaderbanner").show();
$("#showhide-in-home").show();
}
});
if(url == "http://w.com/" && url == "http://w.com/index.php") {
Use OR instead of AND as the URL can be either of them.
if(url == "http://w.com/" || url == "http://w.com/index.php")