Slider

From WebOS101

Jump to: navigation, search

Create a Mojo Slider

<div x-mojo-element="Slider" id="slide-this" class="sliderClass"></div>

Place inside Setup Assistant

YourAssistant.prototype.setup = function() {
 
this.sliderModel = { value: 1, disabled: false }
this.controller.setupWidget("slide-this",
this.attributes = {
minValue: 1,
maxValue: 10
},
 
this.sliderModel);
 
Mojo.Event.listen(this.controller.get('slide-this'), Mojo.Event.propertyChange,
this.handleUpdate.bindAsEventListener(this));
 
}

Slider handler place anywhere inside Scene Assistant.js but not inside of Setup Assistant.

YourAssistant.prototype.handleUpdate= function(event) {
 
Mojo.Log.error("slider: orig: "+this.sliderModel.value);
this.controller.get('your_div').innerHTML = Math.round(this.sliderModel.value);//ROUND OFF NUMBER
 
}
Retrieved from "http://webos101.com/Slider"
Personal tools