views:

113

answers:

2

Hello,

I have a wordpress site running the WP-Coda theme here, and have been working to create a page template. The link to the a page with the template is namastebella.byethost5.com/random (Sorry no hyperlink, can't post 2 as a beginner!)

The "fadethis" javascript function makes animated hovers on the top three links. It works on the main page, but I can't seem to figure out why it doesn't work on the page template at /random. The header is the same, and loads the same script on both, and the html calls for the same tag.

UPDATE: I just added a hello alert after document.ready. It's not loading for the /random page. So the Js isn't loading at all on the page. What's wrong?

Any help?

Thanks, zeemy

+1  A: 

Here is the problem. The site is trying to build a "slider" on line 14 of your global.js. It is failing because you don't have the needed HTML for the panels.

The site that works has all the needed slider html.

Open the site that works and search for this. You will see the difference.

<div id="slider">
Jason Rowe
The fadeThis script that he's written appends that to the anchor tags
Justin Johnson
Look at the page. THe fadeThis script is not running. Line 14 of global.js is blowing chunks on a panel array.
Jason Rowe
Yup, well done. By adding the slider to the random page, I am able to get it working on my local copy.
Justin Johnson
Thanks for the help. Hypothetically, How would I get the hover links to work without the slider?
Azeem Sola
You should just be able to remove that line 14 in the global.js file or fix the code in the slider that is trying to access the first element in the panel array without checking if it exists first.
Jason Rowe
A: 

I pulled your code from your header and ran it through Firebug.

$('.fadeThis').append('<span class="hover"></span>').each(function () {
    var $span = $('> span.hover', this).css('opacity', 0);
    $(this).hover(function () {
        $span.stop().fadeTo(250, 1);
    }, function () {
        $span.stop().fadeTo(250, 0);
    });
});

It runs without any errors and works as expected. I would add some debug output in your document.ready callback to make sure that execution is even getting to that point.

Justin Johnson
I just added a hello alert at the top. It's not loading at /random. So the Js isn't loading at all on the page. What could cause this?
Azeem Sola
Your slider is busted. Line 14 of your global.js file.
Jason Rowe
See Jason Rowe's answer
Justin Johnson