Domanda

I've been trying my hand at creating a custom slideshow from scratch using the Barrel guide "Building a jQuery Slideshow Plugin from Scratch" found here: http://www.barrelny.com/blog/building-a-jquery-slideshow-plugin-from-scratch/. I've been following through step by step but decided to copy and paste the end result into fader.js. The earlier non-optimized code was working correctly.

The page I'm having trouble with is located here: http://dataglyph.com/slidetest/

The errors that are showing up from FireBug are:

SyntaxError: missing formal parameter function animateSlides(active, new){ 

(with an arrow pointing at "new")

fader.js (line 49, col 35)

which points to this block of code in the file:

function animateSlides(active, new){
    if(fading || activeNdx == newNdx){
        return false;
    };
    fading = true;
    $pagers.removeClass('active').eq(newSlide).addClass('active');
    $slides.eq(active).css('z-index', 3);
    $slides.eq(new).css({
        'z-index': 2,
        'opacity': 1
    });

and the other error is:

ReferenceError: easyFader is not defined easyFader($('#Fader'),5000,800); /slidetest/ (line 15)

which points to where the slideshow is instantiated on my index page:

<script>
$(function(){
easyFader($('#Fader'),5000,800);
});
</script>

Can someone give me some insight as to why these errors are occurring?

È stato utile?

Soluzione

Yes, it turned out that new should be newNdx, but there were other issues besides that. I should've used the codepen at the end of the tutorial which had code proven to work.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top