javascript - Bxslider don't initiated with requirejs -
i have problem bxloader , requirejs
.
invite module bxslider per require.js in app.
unfortunately bxloader doesn't initialize.
my view.html
<div class="slider5" > <div class="slide"><img src="http://placehold.it/350x150&text=foobar1"></div> <div class="slide"><img src="http://placehold.it/350x150&text=foobar1"></div> </div>
main.js
requirejs.config({ paths: { jquery: "lib/jquery", "jquery.bxslider":"lib/jquery.bxslider" }, shim: { "jquery.bxslider": { deps: ["jquery"], exports: "bxslider" }
after debugging, have found length of slider elements (length == 0): bxslider.js
$.fn.bxslider = function(options){ if(this.length == 0) return this;
how can be?any thoughts?
define(["app",'jquery', "jquery.bxslider", "text!tpl/movingbox.html"], function(app, $, initbxslider, movingboxtpl) { app.module("movingbox", function( movingbox, app, $, _, bxslider) { movingbox.onstart = function(bxslider) { $('.slider5').bxslider({ slidewidth: 400, minslides: 9, maxslides: 9, moveslides: 1, slidemargin: 10, infiniteloop:true, controls:true, pager:false }); }
Comments
Post a Comment