The source code for this sample can be found here: https://github.com/gomobile/sample-responsivebutton or download the Intel® XDK to check out all the HTML5 Samples.
There is extensive CSS code in this application that enables it to look appropriate for both tablet and smartphone form factors. This line below is located in css/main.css and triggers the styling that is appropriate for a tablet device if the width of the screen is at least 768 pixels.
The code that sets up the event listeners for the two buttons is located in js/main.js. It is called soon after the page is loaded.
Finally, the event handlers are able to update the CSS of the selected button on the fly based on the object passed with the event.
This sample application has been tested on a variety of iOS and Android devices. Since it relies on some HTML5 specific CSS it may not function appropriately on older desktop browsers.