s4
changeset 901:1cff36303150
Handling of the option for "scrollIntoView" changed
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Sat, 02 Jan 2021 19:23:17 +0900 |
parents | 1fa8b4440f8f |
children | d9ecb727edcd |
files | s4-main.js |
diffstat | 1 files changed, 6 insertions(+), 7 deletions(-) [+] |
line diff
1.1 --- a/s4-main.js Sat Jan 02 19:13:27 2021 +0900 1.2 +++ b/s4-main.js Sat Jan 02 19:23:17 2021 +0900 1.3 @@ -165,14 +165,13 @@ 1.4 ajaxSubmit.textContent = ajaxSubmit.back; 1.5 ajaxSubmit.disabled = false; 1.6 console.log("Update "+cnt+"rows"); 1.7 - if (cnt>0) 1.8 + if (cnt>0 && ntr.scrollIntoView) { 1.9 + let option = {behavior: "smooth"}; 1.10 + if (!isOlderJS) option.block = "center"; 1.11 try { // Scroll to last updated row 1.12 - ntr.scrollIntoView({behavior: "smooth", block: "center"}); 1.13 - } catch (e1) { 1.14 - try { // block: "center" is not supported by older agents 1.15 - ntr.scrollIntoView({behavior: "smooth"}); 1.16 - } catch (e2) {} 1.17 - } 1.18 + ntr.scrollIntoView(option); 1.19 + } catch (e1) {} 1.20 + } 1.21 return cnt; 1.22 } 1.23