0

I have the following code: and I want to call

preloadfunction()

  (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?

1

2 Answers 2

2

Isn't the function called "preload", and not "preloadfunction"?

Have you tried

waterwheelCarousel().preload();
Sign up to request clarification or add additional context in comments.

Comments

0

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();

1 Comment

SHOULD I PUT VAR APP BEFORE (function ($) { WHICH IS THE FIRST STATEMNT IN MY CASE

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.