Permalink
Browse files

Fix bug in iPad and Android's browsers. Some browser call onResize() …

…multiple times and cause web page refreshing.
  • Loading branch information...
1 parent 339aa5e commit 87386cdcd4ed6de1b3bc27bee8faf7c64c7e6332 hackerzhou committed Nov 8, 2011
Showing with 8 additions and 2 deletions.
  1. +1 −1 js/functions.js
  2. +7 −1 js/functions_dev.js
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,5 +1,7 @@
// variables
var $window = $(window), gardenCtx, gardenCanvas, $garden, garden;
+var clientWidth = $(window).width();
+var clientHeight = $(window).height();
$(function () {
// setup garden
@@ -26,7 +28,11 @@ $(function () {
});
$(window).resize(function() {
- location.replace(location);
+ var newWidth = $(window).width();
+ var newHeight = $(window).height();
+ if (newWidth != clientWidth && newHeight != clientHeight) {
+ location.replace(location);
+ }
});
function getHeartPoint(angle) {

0 comments on commit 87386cd

Please sign in to comment.