jquery - Javascript replace global parameters in class -


i have developed slider based on foundation in js. has initial configs , functions. 1 instance of slider works, when adding slider page global configs overwritten , first slider controlls second.

here's part of code:

  foundation.libs.slider = {     name: 'slider',     version: '0.1.0',     settings: {         callback: function () {         },         active_class: "active"     },     stat: '',     windowwidth: '',     slide: '',     slidewidth: '',     slidecount: '',     slidesvisible: 0,     bullets: '',     bulletshtml: '',     bulletscount: 0,     bullet: '',     init: function (scope, method, options) {         this.bindings(method, options);     },     events: function () {         var self = this;          this.s('[data-stats]', this.scope).each(function () {             self.slider($(this));          });     }, 

as understand, each [data-stats] overwriting settings. how make global settings part of each object?

i have little knowledge of js , gratefull of help.

you must initialize sliders independently in separate instances , control object instanced. example:

    var slider1 = new slider();     var slider2 = new slider();     slider1.init();     slider2.init(); 

obviously, need methods init separately, , can return selector or entire object.

good luck


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -