Question

I'm trying to implement joss benner's fix as shown here. I need to implement this code:

slider.setOpts = function(opts) {
  for (var opt in opts) {
    vars[opt] = opts[opt];
  }
  slider.setup();
}

slider.getOpts = function() {
  return vars;
}

I've tried with this fiddle here, but I just get

Uncaught ReferenceError: slider is not defined 

in the console. Not really what I'm doing. The other commenters seem to be able to implement it no problem.

Could someone also explain the meaning behind the code... what is slider? A class? A function? Where should I place the above code to add the .setOpts function?

Was it helpful?

Solution

He wrote

I added these public methods to flexslider

To do so, you have to add those lines of code inside the jquery.flexslider.js-file and not in another js-file as you did in the fiddle. The error tells you what the problem is. And in your case, slider is in fact not defined, because the slider-variable is being declared inside a codeblock of the jquery.flexslider.js which means, there is no reference to this variable outside of this block.

The public methods start in line 426, so add your code there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top