Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery page fadeIn() only working on index page
    text
    copied!<p>Thanks everyone, for the quick help! Script now works. I've updated the site and code below. Maybe someone can find this code useful. :)</p> <hr> <p>I've gotten the page (<a href="http://www.katmcgo.com" rel="nofollow">http://www.katmcgo.com</a>) to fade in as desired using jQuery. However, it only fades in on the index page -- all subsequent pages load as normal.</p> <p>I have the following script in the header of each page (including the sub-pages that are not fading in); it is included in each page using PHP:</p> <pre><code>$(document).ready(function() { function fadePage() { // Target the tags you want to effect with the fade var fadingTag = "section"; var fadingTag2 = "hr"; var delay = 0; // Initialize delay - Should start at 0 var delayStagger = 600; // Delay stagger - Time between elements fading in var fadingNum = document.getElementsByTagName(fadingTag).length; // Find out how many elements you need to hide // Get and fix the overall document height before it disappears (which will happen when elements are hidden) var pageHeight = $(document).height() + "px"; $("#wrapper").css("height", pageHeight); // Hide all targeted tags $(fadingTag).css("display", "none"); $(fadingTag2).css("display", "none"); // Fade each targeted tag in, one by one for (var i = 0; i &lt; fadingNum; i++){ $($(fadingTag).get(i)).delay(delay).fadeIn(delayStagger); $($(fadingTag2).get(i)).delay(delay).fadeIn(delayStagger); delay += 350; } } fadePage(); }); </code></pre> <p>I've been racking my brain as to why this is happening, and doing searches to the find the answer, but coming up with nothing...</p> <p>This page is in the early stages, so I'm just doing dev in Firefox and Safari... fade works in both, but only on the first page. Any help would be greatly appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload