Skip to content
This repository has been archived by the owner. It is now read-only.

JavaScript Helper

myfreeweb edited this page Apr 19, 2012 · 8 revisions

A JavaScript helper is included in the boilerplate with namespace MBP, it's located at js/mylibs/helper.js. There are a couple of kick-ass functions that help you to improve mobile user experience.

iPhone Scale Bug Fix

MBP.scaleFix is used to fix the iPhone reflow scale bug, read more about it here: a fix for iphone viewport scale bug

###Hide URL Bar Description:
MBP.hideUrlBar is used to hide the URL bar at the top of mobile Safari on your iOS. Mobile space is limited and this helps to leverage every pixel on the screen to maximize display area.

###Fast Buttons (only use this if you only target webkit browsers, we are still testing out cross-browser support) Description:
MBP.fastButton is used to make instant responsive buttons, 300ms faster to be exact. (It uses touchstart to detect click event.)
new MBP.fastButton(document.getElementById('myBtn'), function() {alert("clicked")});

###Autogrow textarea Description:
MBP.autogrow is used to make textarea to grow its height while you are entering more lines of text.
new MBP.autogrow(document.getElementById('myTextarea'), 14); // 14 -- line height