Javiera
12 Mar 2008, 11:54 PM
Anyone interested in an iphone-style toggle? Perhaps for editor /property grids? I think it would be a neat alternative to a check or combo box. Thoughts?
<html><head>
<script type="text/javascript">
Ext.onReady(function(){
var toggle = 'off';
var tpl = {
on: new Ext.Template('<img src="btn_on.jpg">'),
off: new Ext.Template('<img src="btn_off.jpg">')
};
Ext.get("btn").on('click', function() {
tpl[toggle].overwrite('btn');
toggle = (toggle == 'on') ? 'off' : 'on';
});
});
</script>
</head>
<body>
<a id="btn"><img src="btn_off.jpg"></a>
</body>
</html>
<html><head>
<script type="text/javascript">
Ext.onReady(function(){
var toggle = 'off';
var tpl = {
on: new Ext.Template('<img src="btn_on.jpg">'),
off: new Ext.Template('<img src="btn_off.jpg">')
};
Ext.get("btn").on('click', function() {
tpl[toggle].overwrite('btn');
toggle = (toggle == 'on') ? 'off' : 'on';
});
});
</script>
</head>
<body>
<a id="btn"><img src="btn_off.jpg"></a>
</body>
</html>