Wednesday, January 22, 2014

Screen Width and Height for iPhone, iPad, Android Tablets and Smartphones Using Javascript

When it comes to screen width and height, it is a bit tricky for tablet devices as the width and height vary according to the orientation of the tablet. Therefore it is crucial to detect the screen dimension for websites that are sensitive to the width and height of the screen such as the sticky notes on the web page. The sticky note usually has to be accurate on the location on the web page or...
Read More »

Monday, January 20, 2014

Strange Tablet (Touch Device) Problem with Javascript's MarginLeft/MarginRight DOM property

This is really hard to explain. If you do your coding in Javascript to move a DIV/SPAN manipulating the value in marginLeft/marginRight DOM property, you will run into a problem that your touch devices, ie., iPad, Android tablet/smartphones won't work with this trick if you have a align=center property somewhere before the DIV/SPAN. Foe example: . . . <table><tr><td align=center><div id=moveDiv>...</div></td></tr></table> <script> document.getElementById('moveDiv').style.marginLeft...
Read More »

Preload Images using Javascript

There are times that you need to preload images on your web page to avoid the long load time required for a dynamic HTML site. I've tried many examples found on the web but none of them are really working on today's browsers. Here's my way of making this happen: <script> var image_loc = new Array('/image/pic1.jpg','/image/pic5.jpg','/image/pic13.jpg','/image/pic9.jpg'); var elem; for (i = 0; i < image_loc.length; i++) {    elem = document.createElement("span");    elem.id...
Read More »