iMarkDesigns
iMarkDesigns

Reputation: 1262

requirejs and other libraries

Ok, this is my first time to try requireJS, although i dont know what exactly the setup. i just base only what i saw in their site and youtube tutorial.

Basically, i have multiple plugins that i wanted to use over my site, and trying to avoid deferred javascript notification from pagespeed. so i try requirejs, and yeah i see it working, but after i include one of the plugins i would like to you, i am partly lost in the scene of coding.

Ok, lets make it short here. I want to use SlidesJS, and i have the codes and css at my homepage. then created main and include jquery. the question is, how can i encode SlidesJS library inside main.js and have it fully functioning with this codes.

    $('#slides-text').slides({
    preload: true,
    preloadImage: 'plugins/slidesjs/img/loading.gif',
    play: 5000,
    pause: 2500,
    hoverPause: true
}); 

I will appreciate your help.

Upvotes: 0

Views: 128

Answers (1)

xandy
xandy

Reputation: 27421

In main.js:

define(["slides.js"], function(){
    // within here, the slides.js is already loaded
    // so you can safely put the code in your question here
});

Upvotes: 1

Related Questions