Page 1 of 1

toggle text and background color

Posted: Wed May 01, 2013 11:10 am
by Rafael Martínez

We are changing the style, text color and background, of the toggle. With .ui-btn-down-b we can change these values when te toggle is "Off", but, how can we do to change these values in the status "On" of the toggle?


toggle text and background color

Posted: Wed May 01, 2013 1:40 pm
by maxkatz

I'm not sure I fully understand the question.. but you could check the current status of the component and based on that apply the correct style.


toggle text and background color

Posted: Wed May 01, 2013 2:13 pm
by Rafael Martínez

We set in the "value change" event for the toggle:

var dotoggle = Appery('toggleNoticias').attr("dotoggle");
if (dotoggle == "1") {
Appery('toggleNoticias').css('color', 'green');
Appery('toggleNoticias').attr("dotoggle", "0");
} else {
Appery('toggleNoticias').css('color', 'red');
Appery('toggleNoticias').attr("dotoggle", "1");
}

but the color of the text don't change


toggle text and background color

Posted: Wed May 01, 2013 3:18 pm
by maxkatz

Make sure your selector is correct:
Appery('toggleNoticias')

and you are applying styles to the right element.

Appery(..) is just a shortcut function: http://docs.appery.io/javascript-api/.