aboutsummaryrefslogtreecommitdiff
path: root/public/javascripts/libs/ios-viewport-scaling-bug-fix.js
diff options
context:
space:
mode:
authorBrandon Mathis <brandon@imathis.com>2011-05-15 18:33:00 -0400
committerBrandon Mathis <brandon@imathis.com>2011-05-15 18:33:00 -0400
commitc7d5365f81552cae16bbb91696ca3e67b4a0a2e9 (patch)
tree76c57e41828a3492535cde7fe82bef98ccea0eb4 /public/javascripts/libs/ios-viewport-scaling-bug-fix.js
parente4c2d5790bac6a74037638fde049c374fc44cc7b (diff)
downloadmy_new_personal_website-c7d5365f81552cae16bbb91696ca3e67b4a0a2e9.tar.xz
my_new_personal_website-c7d5365f81552cae16bbb91696ca3e67b4a0a2e9.zip
major refactoring, improved file watching, changed site to public to support rack via pow (http://pow.cx) also implemented the basics of a 320 and up design refresh on the classic theme. This should make it great for mobile reading
Diffstat (limited to 'public/javascripts/libs/ios-viewport-scaling-bug-fix.js')
-rw-r--r--public/javascripts/libs/ios-viewport-scaling-bug-fix.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/public/javascripts/libs/ios-viewport-scaling-bug-fix.js b/public/javascripts/libs/ios-viewport-scaling-bug-fix.js
new file mode 100644
index 00000000..49f0d443
--- /dev/null
+++ b/public/javascripts/libs/ios-viewport-scaling-bug-fix.js
@@ -0,0 +1,20 @@
+// https://gist.github.com/901295
+// By @mathias, @cheeaun and @jdalton
+
+(function(doc) {
+ var addEvent = 'addEventListener',
+ type = 'gesturestart',
+ qsa = 'querySelectorAll',
+ scales = [1, 1],
+ meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
+ function fix() {
+ meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1];
+ doc.removeEventListener(type, fix, true);
+ }
+ if ((meta = meta[meta.length - 1]) && addEvent in doc) {
+ fix();
+ scales = [.25, 1.6];
+ doc[addEvent](type, fix, true);
+ }
+}(document));
+