Jump to content

[Resolved] Home Page Only Script


basicguy

Recommended Posts

Hi, I'm trying to place a 'Page Peel' script onto my website to advertise Sale Items - Got the 'Peel' working but the problem is, I only want it to appear on the 'Home' Page.

I've tried adding a basic bit of PHP to determine the URL but I think that the 'HTTPS' combined with the '.htaccess' are preventing me getting the correct one, so my if/else script doesn't work.

Can anyone assist?

Link to comment
Share on other sites

On the Homepage, there is one or two identifiers you can use to activate the script: the class home_wrapper and, if your Homepage has a Homepage Document, the ID content_homepage.

With either of these, you can use them in a jQuery selector to determine if the object element is real or null.

Link to comment
Share on other sites

Thank you for the assistance.

I'm checking for the 'announcement' div  which is the 'Welcoming Text' on the home page within the home page document... but am still not getting the correct result

At the footer of main.php I include:

test.js 

Contents:

 if ($(".announcement" ) ) {
   alert('does exist'); // Appears correctly
   //writeObjects(); // Script Starter
} else
{
     alert('does not exist');
}

Have subsequently tried this with: content_homepage, home_wrapperlatest_product plus several others that ONLY appear on the home page and yet the 'Peel' Still appears on every page. Help!!

I am a schmoe! 

Wrote the jQuery wrong! Should have been: 

if ($('#announcement').length > 0) { 
     writeObjects();

Note the two stoooopid errors!

Thanks again for the help! All working now.

Edited by basicguy
I'm an idiot!
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...