Created
January 31, 2015 02:04
-
-
Save johnbocook/a19bad4dc38b4973c705 to your computer and use it in GitHub Desktop.
Gets pathname (domain.com/pathname) and add's background image of same name.
This file contains 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
//Get Pathname and Add background image of path for dynamic backgrounds. | |
var loc = window.location.pathname.substring(1); | |
if (loc === '') { | |
$( "#marketing-header" ).css('background-image', 'url(/img/default-bg.jpg)'); | |
} else { | |
$( "#marketing-header" ).css('background-image', 'url(/img/'+loc+'.jpg)'); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment