From 3ad9b26c9a7c6fb66d92d02d69ae2c4ff5d84bb4 Mon Sep 17 00:00:00 2001 From: rulingcom Date: Wed, 24 Aug 2022 19:50:27 +0800 Subject: [PATCH] Updated. --- assets/javascripts/app.js | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 9a036eb..c041a9e 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -748,16 +748,28 @@ function transdate(){ } $(document).on('focusin','*',function(event){ // event.stopPropagation(); - var _this = $(document.activeElement);//$(this); - var topOffset = window.temp_scrollY + window.top_barrier_height; - var ele_offset = _this.offset().top - topOffset; - if(ele_offset < 0){ - window.scroll(window.temp_scrollX, window.temp_scrollY + ele_offset); - window.temp_scrollY = Math.max(window.temp_scrollY + ele_offset, 0); + if(window.focus_timeout_id){ + window.clearTimeout(window.focus_timeout_id); } - if ($('header>.kenjohn').attr('class') == "kenjohn" && _this.is('a.orbit-bar-logo')){ - $('header>.kenjohn').addClass('navRel'); - $('#gotocenter').focus(); + var _this = $(document.activeElement);//$(this); + if(!_this.hasClass('close-screen-btn')){ + var topOffset = window.temp_scrollY + window.top_barrier_height; + var ele_offset = _this.offset().top - topOffset; + if(ele_offset < 0){ + window.scroll(window.temp_scrollX, window.temp_scrollY + ele_offset); + window.temp_scrollY = Math.max(window.temp_scrollY + ele_offset, 0); + } + window.focus_timeout_id = window.setTimeout(function(){ + var ele_offset = _this.offset().top - topOffset; + if(ele_offset < 0){ + window.scroll(window.temp_scrollX, window.temp_scrollY + ele_offset); + window.temp_scrollY = Math.max(window.temp_scrollY + ele_offset, 0); + } + }, 800); + if ($('header>.kenjohn').attr('class') == "kenjohn" && _this.is('a.orbit-bar-logo')){ + $('header>.kenjohn').addClass('navRel'); + $('#gotocenter').focus(); + } } }); $('.group').each(function(){