diff --git a/view/peko/activity/act-ocean/js/index.js b/view/peko/activity/act-ocean/js/index.js index 534d8ce..5b767a6 100644 --- a/view/peko/activity/act-ocean/js/index.js +++ b/view/peko/activity/act-ocean/js/index.js @@ -1294,4 +1294,16 @@ $(function () { $countDown.html(countDownTime) } }) -}) \ No newline at end of file +}) +//返回页面 重新请求接口 +var hiddenProperty = 'hidden' in document ? 'hidden' : + 'webkitHidden' in document ? 'webkitHidden' : + 'mozHidden' in document ? 'mozHidden' : null; + +var visibilityChangeEvent = hiddenProperty.replace(/hidden/i, 'visibilitychange'); +var onVisibilityChange = function () { + if (!document[hiddenProperty]) { + location.reload() + } +} +document.addEventListener(visibilityChangeEvent, onVisibilityChange); \ No newline at end of file