-1

I am trying to call a custom function inside a bxslider callback but the function doesn't get recorgnized (aka: Uncaught Reference Error: nextSlideCustom() is not a function)

my current code looks like

    var slider=$('#slider1').bxSlider({
         pager: 'true',
         onSlideNext: nextSlideHandle()
    });

and in a different js file I am defining this function:

function nextSlideHandle(){
    console.log("huhu");
}

so what's the problem with my code, or is it mory likely a wrong configuration of the slider or something?

thanks in advance!

FalcoB
  • 1,333
  • 10
  • 25

1 Answers1

3

make sure nextSlideHandle is defined before calling bxSlider, and also do it without parantheses, because that way, you're passing the result of the function and not the function itself, hence; undefined function error.

var slider=$('#slider1').bxSlider({
     pager: 'true',
     onSlideNext: nextSlideHandle
});
keune
  • 5,779
  • 4
  • 34
  • 50
  • thank you for you reply!! actually it is before the call of bxslider, but never the less, its acting like that.... could there be any other reason? – FalcoB Sep 11 '15 at 15:18
  • with the information you have provided, i can't think of any. – keune Sep 11 '15 at 15:23