titanium - How to enable button focus on touchStart? -
i have created button, need response button like, on touch of button, button focus should enable alter in background color. how can that?
my code is, view:
<button class="button" id="proceedbutton" onclick="openquestionnaire">proceed</button>
style:
".button":{ width: '50%', top: '25dp', borderradius: 8, borderwidth: 1, bordercolor: '#808080', backgroundgradient: { type: "linear", startpoint: { x: "0%", y:"0%"}, endpoint: { x: "0%", y:"100%"}, colors: [ { color: "#4f94cd", offset: 0.0 }, { color: "#4f94cd", offset: 1.0 } ] } }
controller:
$.proceedbutton.addeventlistener('touchstart', function() { $.proceedbutton.isfocused = true; }); $.proceedbutton.addeventlistener('touchend', function() { $.proceedbutton.isfocused = false; });
the above code not working. need slight chage in background color while touch of button.
any solution!!
as @codeforfun mentioned can utilize backgroundselectedcolor
property of button.
also next states can used button in titanium.
disabled : backgrounddisabledimage , backgrounddisabledcolor normal : backgroundimage , backgroundcolor focus : backgroundfocusedimage , backgroundfocusedcolor selected : backgroundselectedimage , backgroundselectedcolorhope helpful.
edit : illustration of usage:
view :
<button class="button" >proceed</button>
tss :
".button":{ width: '50%', top: '25dp', backgroundselectedcolor : "#4f94cd" //usage }
titanium titanium-mobile titanium-alloy tss
No comments:
Post a Comment