Methods
var slider = new MasterSlider(); slider.setup('masterslider' , {width:800, height:350}); slider.api.index(); // returns current slider index. slider.api.count(); // returns total number of slides. slider.api.next(); // next slide. slider.api.previous(); // previous slide. slider.api.gotoSlide(4); // moves to 4th slide. slider.api.pause(); // pauses the slider timer. slider.api.resume(); // resumes the slider timer. slider.api.currentTime(); // returns the percentage of elapsed time. slider.api.destroy(); // removes the slider.
Properties
slider.api.so // returns the object of slider options. slider.api.view // returns the slider transition object. slider.api.view.slideList // returns a array of all slides. slider.api.viwe.currentSlide // returns the current slide object.
Events
slider.api.addEventListener(MSSliderEvent.INIT , function(){ // dispatches when the slider's current slide change starts. }); slider.api.addEventListener(MSSliderEvent.CHANGE_START , function(){ // dispatches when the slider's current slide change starts. }); slider.api.addEventListener(MSSliderEvent.CHANGE_END , function(){ // dispatches when the slider's current slide change ends. }); slider.api.addEventListener(MSSliderEvent.WAITING , function(){ // dispatches whenever the slider timer updates. }); slider.api.addEventListener(MSSliderEvent.RESIZE , function(){ // dispatches when the slider is resized. }); slider.api.addEventListener(MSSliderEvent.VIDEO_PLAY , function(){ // dispatches when the slide video played. }); slider.api.addEventListener(MSSliderEvent.VIDEO_CLOSE , function(){ // dispatches when the slide video closed. }); slider.api.view.addEventListener(MSViewEvents.SWIPE_START , function(){ // dispatches when swipe dragging starts. }); slider.api.view.addEventListener(MSViewEvents.SWIPE_END , function(){ // dispatches when swipe dragging ends. }); slider.api.view.addEventListener(MSViewEvents.SWIPE_MOVE , function(){ // dispatches when swipe dragging moves. }); slider.api.view.addEventListener(MSViewEvents.SWIPE_CANCEL , function(){ // dispatches when swipe dragging cancels. });
Please notice that for the events of the view object ( MSViewEvents ) you need to define the event in the MSSliderEvent.INIT first.
For example for using the event of when the swipe dragging ends, you should setup the event as the following:
slider.api.addEventListener( MSSliderEvent.INIT, function(){ slider.api.view.addEventListener(MSViewEvents.SWIPE_END, function(){ // dispatches when swipe dragging ends. console.log('MS Swipe ended!'); }); } );
Overview
Content Tools