Rafael Martínez
Posts: 0
Joined: Tue Apr 23, 2013 5:19 pm

toggle text and background color

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?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

toggle text and background color

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.

Rafael Martínez
Posts: 0
Joined: Tue Apr 23, 2013 5:19 pm

toggle text and background color

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

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

toggle text and background color

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/.

Return to “Issues”