As I am making a HTML5 app for android devices using the Intel XDK I ran into a problem with the fonts. I use only em thinking that would work great on any screen size since its relative. I soon realized that it didn’t and that the text got reeeaally small on my phone when I uploaded the app. The reason seems to be zoom-related but I can’t swear to what the problem is aside from the fact that the screen has around 800px width and the standard font-size is still 16px which makes it unreadable. So I had to calculate the size myself and I found that the following formula worked like a charm:
var fontSize = Math.round(window.innerWidth * 0.04);
$('body').css('font-size', fontSize + "px");
This sets your font to a relatively easy reading size. Change the percentage if you need to alter the size!
Right, so I thought it would be great to write a HTML5 app in windows 8 since it’s supported and everything. The one thing I refuse to skip though is jQuery. So, I added jQuery 1.9.1 to my app, referenced it in my html-file and ran the app. The following popup showed up:
I searched the web and I found that the only solution that seems safe at the time of writing is to use a “fixed” version for Windows 8, supplied by a company called AppendTo. The files can be downloaded here: https://github.com/appendto/jquery-win8
Currently the latest jQuery release is 1.9.1 and the AppendTo conversion is 1.8.2 but it’s close enough and it works for me.
According to a couple of videos floating around and some articles on the subject the jQuery 2.0 release will have full support for Windows 8 so that should be great. But until then the AppendTo solution seems to be the best one out there.
When you are working with the jQueryUI API you have some CSS classes to utilize when it comes to gadget designing. These classes can be used in order to create a unified, exchangeable design. The state classes represent different states a gadget, or anything else really, can be in (such as highlighted or in error). The states are:
//your code here
//your code here
The demo section itself doesn’t exist so don’t bother going there yet :), but I’m gonna put something up there to store all my demo attempts!
The game is fairly simple and looks like this:
Whereas the old game was just a demo I made to see if a game could actually be made in jQuery and be fun, this attempt is a bit more serious to see if a game could be really fun, and still look good and run smoothly. Well, try the game and leave a comment on it. There may be a third version developed using HTML5 and CSS3 as well, We’ll see…