View Single Post
  #1  
Old 10-02-2012, 03:23 PM
benjamin_sbm benjamin_sbm is offline
Registered User
Genesis Member
 
Join Date: May 2012
Posts: 23
Default Where to put Jquery Javascript

Hey,

I'm sure this is a stupid question, but I have continuously struggled with adding jquery Javascript to my genesis wordpress sites.

For instance, I am following a tutorial on sliding backgrounds (http://www.webdevtuts.net/coding/cre...using-jquery/#). I have everything in place, but the javascript that creates the slide doesn't seem to be working.

http://builder22.strangebirdmedia.com/?page_id=2

I tried adding the javascript to the wp_head Hook in Simple Hooks. I also tried adding it under Theme Setting>Header Scripts.

What am I missing?

Here is the script:

<script type="text/javascript">

function slideSwitch() {
var $active = $('#slideshow IMG.active');

if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

// use this to pull the images in the order they appear in the markup
var $next = $active.next().length ? $active.next()
: $('#slideshow IMG:first');

// uncomment the 3 lines below to pull the images in random order

// var $sibs = $active.siblings();
// var rndNum = Math.floor(Math.random() * $sibs.length );
// var $next = $( $sibs[ rndNum ] );

$active.addClass('last-active');

$next.css({opacity: 0.0})
.addClass('active')
.animate({opacity: 1.0}, 1000, function() {
$active.removeClass('active last-active');
});
}

$(function() {
setInterval( "slideSwitch()", 5000 );
});

</script>

I am not experienced in javascript, so please be patient with me.

You have been a tremendous help in the past, present, and I can assume in the future,

Thanks again,