Created
October 3, 2016 18:41
-
-
Save malachi358/6744aed8d5d75e1e0728ae87548b0981 to your computer and use it in GitHub Desktop.
Add Div Class based on url
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Malachi Added Code Below */ | |
// Collection Link Disable ==> // | |
$(document).ready(function() { | |
$('a[href="/collections"]').on('click', function() { | |
return false; | |
}); | |
/*$(function() { | |
var loc = window.location.href; // returns the full URL | |
if(/intestinal-health/.test(loc)) { | |
$('.collection-banner').css('background', ''); | |
} | |
}); | |
*/ | |
if(window.location.href.indexOf("intestinal-health") > -1) { | |
// alert("your url contains the name franky"); | |
$('.collection-banner').addClass('intestinal-health'); | |
} | |
if(window.location.href.indexOf("baby-probiotic") > -1) { | |
// alert("your url contains the name franky"); | |
$('.collection-banner').addClass('baby-probiotic'); | |
} | |
if(window.location.href.indexOf("frontpage") > -1) { | |
// alert("your url contains the name franky"); | |
$('.collection-banner').addClass('frontpage'); | |
} | |
if(window.location.href.indexOf("womens-probiotic") > -1) { | |
// alert("your url contains the name franky"); | |
$('.collection-banner').addClass('womens-probiotic'); | |
} | |
if(window.location.href.indexOf("dophilus") > -1) { | |
// alert("your url contains the name franky"); | |
$('.collection-banner').addClass('dophilus'); | |
} | |
if(window.location.href.indexOf("childrens") > -1) { | |
// alert("your url contains the name franky"); | |
$('.collection-banner').addClass('childrens'); | |
} | |
if(window.location.href.indexOf("pets") > -1) { | |
// alert("your url contains the name franky"); | |
$('.collection-banner').addClass('pets'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment