How can I achieve this?
for each pages I have attached a unique class-name so I can target them by css later.
- body.pageHome
- about.pageAbout
- contact.pageContact
I want to run a function but only targeting the homepage.
eg.
if($('body').hasClass('pageHome')) {
callMe;
}
function callMe() {
alert('I am Home!');
}
It looks like you’re close. To call
callMe, you’ll want parenthesis to indicate that it’s a function call: