Information Technology Reference
In-Depth Information
var img = $('li[rel="' + correct + '"] img').attr('src');
var score = $('.score span');
// restart the game if game over
if($('ul').hasClass('gameover')) {
init();
}
else {
// swap out default avatar for correct avatar
$('#tweet .avatar img').attr('src', img);
if(name == correct) {
score.text(parseInt(score.text())+100);
$('section').addClass('win');
}
else {
$('section').addClass('fail');
}
// add gameover class to page
$('ul').addClass('gameover');
}
});
});
And there you have it! For those of you coding along, congratulations, you have officially
completed your first mobile web application. You can fire up your trusted Android device
now (if you haven't already done so already), connect to the same network that your
computer is on, and view your new application on it. To do so, just point your device's
browser to the IP address of your computer. You can find your IP address by opening a
command prompt (Windows) and running the ipconfig command (see Figure 2-9) or by
opening a terminal (OS X/Linux) and running the ifconfig command.
Figure 2-9. The command prompt on Windows 7 displaying our server's IP address
There you have it - your first application.
 
Search WWH ::




Custom Search