Skip to content

Commit

Permalink
修复android旋转屏幕后没有调整视图尺寸的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoda committed Jan 24, 2014
1 parent 1bd3e49 commit 49f612c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
10 changes: 9 additions & 1 deletion dist/spa.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,21 @@
}
}

$win.on('spa:adjustfullscreen orientationchange', function(event) {
$win.on('spa:adjustfullscreen' + ($.os.ios?' orientationchange':''), function(event) {
if(requestID !== undefined) {
cancelAnimationFrame(requestID)
requestID = undefined
}
requestID = requestAnimationFrame(adjust)
})
// android下orientationchange触发的时候页面很可能还没有渲染好
// 所以马上取数据或者短延时取数据都有问题。
// 暂时没有特别好的思路来处理这个问题
$.os.android && $win.on('orientationchange', function(event) {
clearTimeout(resizeID)

resizeID = setTimeout(adjust, 500)
})

$win.on('resize', function(event) {
clearTimeout(resizeID)
Expand Down
Loading

0 comments on commit 49f612c

Please sign in to comment.