tags:

views:

214

answers:

2

I am trying to figure out what is wrong with this code,

I need to manually target slides from within the slide it self but the click functions are not working.

   $('#signup-content').cycle({ 
        fx: 'scrollLeft',
        timeout: 0, 
        speed:   300,
        prev: '#previous',
        next:'#next',
        after: onComp,
        startingSlide: 0});

When I add this:

$('#next01').click(function() { 
        $('#signup-content').cycle(1); 
        return false; 
    });

The Button Doesn't do anything, The cycle works great, I omitted the onComp function as it's not worth posting, but it works.

It is in a document ready statement. And under the first call for cycle.

On Click gets this error:

Error: second argument to Function.prototype.apply must be an array Source File: http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js Line: 12

UPDATE:

When I changed the version from 1.3.2 to 1.3.1 the above works and the above error is not there.

I am not sure what 1.3.2 has that causes it to become wrong, any ideas?

+3  A: 

I notice that your script isn't wrapped in a document ready check. It's quite possible that when your script runs, the elements to which you're attaching handlers do not exist. Unless you're doing intermediate level stuff, you will probably always want your jQuery code to run when the document has finished loading and is ready. This is how its done:

$(document).ready(function() {
    // code inside of here will run when the document has finished loading.
});
Ken Browning
The Script is wrapped in this.
matthewb
A: 

I think Ken is right. Either wrap jQuery code in docReady as above, or move your script to the bottom of the page. You're currently defining functions on DOM objects that don't yet exist.

Sean O