This commit is contained in:
rulingcom 2022-10-20 12:08:15 +08:00
parent 6fa6085c3e
commit 25859bda2e
1 changed files with 4 additions and 4 deletions

View File

@ -751,15 +751,15 @@ function transdate(){
window.clearTimeout(window.focus_timeout_id); window.clearTimeout(window.focus_timeout_id);
} }
var _this = $(document.activeElement);//$(this); var _this = $(document.activeElement);//$(this);
if(!_this.hasClass('close-screen-btn')){ if($('body').css('position') != 'fixed' && !_this.hasClass('close-screen-btn') && !_this.hasClass('navbar-toggle')){
var topOffset = window.temp_scrollY + window.top_barrier_height; var ele_offset = _this[0].getBoundingClientRect().top - window.top_barrier_height;
var ele_offset = _this.offset().top - topOffset; console.log(_this, ele_offset)
if(ele_offset < 0){ if(ele_offset < 0){
window.scroll(window.temp_scrollX, window.temp_scrollY + ele_offset); window.scroll(window.temp_scrollX, window.temp_scrollY + ele_offset);
window.temp_scrollY = Math.max(window.temp_scrollY + ele_offset, 0); window.temp_scrollY = Math.max(window.temp_scrollY + ele_offset, 0);
} }
window.focus_timeout_id = window.setTimeout(function(){ window.focus_timeout_id = window.setTimeout(function(){
var ele_offset = _this.offset().top - topOffset; var ele_offset = _this[0].getBoundingClientRect().top - window.top_barrier_height;
if(ele_offset < 0){ if(ele_offset < 0){
window.scroll(window.temp_scrollX, window.temp_scrollY + ele_offset); window.scroll(window.temp_scrollX, window.temp_scrollY + ele_offset);
window.temp_scrollY = Math.max(window.temp_scrollY + ele_offset, 0); window.temp_scrollY = Math.max(window.temp_scrollY + ele_offset, 0);