Updating element styles
As we build our applications and apply a number of styles and properties to define the layout and visual representation of elements, we also need to be able to update and alter the aesthetics and styles to reflect changes or events within the application.
How to do it...
In this recipe, we will read, write, and detect the style properties and class attributes assigned to selected elements using XUI's built-in style functions:
Firstly, create a new PhoneGap project named
element
by running this line:phonegap create element com.myapp.element element
Add the devices platform. You can choose to use Android, iOS, or both:
cordova platform add ios cordova platform add android
Open
www/index.html
. Let's clean up the unnecessary elements. Include a reference to the XUI JavaScript library and the Cordova JavaScript file.We write a new
script
tag block before the closinghead
tag, which will hold our custom PhoneGap application code. Define an emptyonLoad
function inside the...