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

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.