Skip to content

Commit 63c4af4

Browse files
authored
fix(mobile): add a small tolerance before page reloading to prevent small fluctuation.
1 parent b3bfe4a commit 63c4af4

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

js/app.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ var globalData = {
44

55
modalbox_size: `${Math.round($(window).width() - 8)}px`,
66

7-
starting_width: $(document).width()
7+
starting_width: $(document).width(),
8+
9+
tol_resize: 15
810

911
};
1012

@@ -14,7 +16,7 @@ $(window).on('resize', () => {
1416

1517
let newWidth = $(document).width();
1618

17-
if (globalData.starting_width !== newWidth) document.location.reload(true);
19+
if (Math.abs(globalData.starting_width - newWidth) > globalData.tol_resize) document.location.reload(true);
1820

1921
});
2022

@@ -237,4 +239,4 @@ $(document).ready(function () {
237239

238240
});
239241

240-
$("#copyright").html(new Date().getFullYear());
242+
$("#copyright").html(new Date().getFullYear());

0 commit comments

Comments
 (0)