Problems with initiating orbit slider multiple times Problems with initiating orbit slider multiple times javascript javascript

Problems with initiating orbit slider multiple times


First of all be sure that there's no conflict because of the variety of your scripts. I think changing the code to:

$(".slider").each(function($element) {  sliderInstances.push(new Foundation.Orbit($element, sliderOptions));});

or

$(".slider").each(function() {   sliderInstances.push(new Foundation.Orbit($(this), sliderOptions));});

will help.


Im unable to test out your code but I noticed a small discrepency that might be causing you some issue.

$(".slider").each(function(element) {  sliderInstances.push(new Foundation.Orbit($(element), sliderOptions));});

The each statement is missing an argument. The first argument returns the index and the second one returns the element. The Element is returning the index count of the loop not the element that you are hoping for. It should be...

$(".slider").each(function(index, element) {  sliderInstances.push(new Foundation.Orbit($(element), sliderOptions));});

That might be one reason why you having issues initiating the oribit slider.


The "element" parameter that $.each returns doesn't need to be within $(), try like this and let's see what happens.

$(".slider").each(function(element) {     sliderInstances.push(new Foundation.Orbit(element, sliderOptions)); });