转换为元数据:
%meta{content: "width=device-width, initial-scale=1.0, minimum-scale=0.25, maximum-scale=1.6, user-scalable=yes", name: "viewport"}
到全局脚本:
if navigator.platform.toLowerCase() is "ipad"
viewport = $ "meta[name='viewport']"
viewport_content = viewport.attr("content")
# reset initial zoom
viewport.attr "content", "width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=yes"
setTimeout =>
viewport.attr "content", viewport_content
, 0
# reset zoom on rotate
timeout = null
window.onorientationchange = ->
clearTimeout timeout if timeout?
viewport.attr "content", "width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=yes"
timeout = setTimeout =>
viewport.attr "content", viewport_content
, 1000