Reputation: 334
I have the following code: and I want to call
(function ($) {
$.fn.waterwheelCarousel = function (options) {
options = $.extend({}, $.fn.waterwheelCarousel.defaults, options || {});
return $(this).each(function () {
var data = {
itemsContainer: $(this).find(".carousel-images"),
totalItems: $(this).find(".carousel-images img").length,
containerWidth: $(this).width(),
containerHeight: $(this).height(),
currentCenterItem: null,
items: [],
itemDistances: [],
waveDistances: [],
itemWidths: [],
itemHeights: [],
itemOpacities: [],
carouselRotationsLeft: 0,
currentlyMoving: false,
itemsAnimating: 0,
currentSpeed: options.speed,
intervalTimer: null
};
// Setup the carousel
beforeLoaded();
// Preload the images. Once they are preloaded, the passed in function
// will be called and the carousel will be setup
preload(function () {
setupDistanceArrays();
setupCarousel();
setupStarterRotation();
});
I have tried :
waterwheelCarousel().preloadfunction()
and it's give me undefined method
also I have tried :
var t = $("#waterwheelcarouseldefault").waterwheelCarousel();
t.preloadfunction();
with no luck any one knows how to call this function?
Upvotes: 0
Views: 329
Reputation: 304
You could also create an object of your structure this way the code will get more readable. for example:
var app =
{
// Setup the carousel
beforeLoaded : beforeLoaded(),
preload: function () {
setupDistanceArrays();
setupCarousel();
setupStarterRotation();
}
};
this way you can access your function by typing app.preload();
Upvotes: 0
Reputation: 155
Isn't the function called "preload", and not "preloadfunction"?
Have you tried
waterwheelCarousel().preload();
Upvotes: 2