|
397 | 397 | tocItems[tocItems.length - 1].classList.add("toc-active");
|
398 | 398 | };
|
399 | 399 | //scroll to top
|
400 |
| - if(window.scrollY==0) { |
| 400 | + if(window.pageYOffset === 0) { |
401 | 401 | var tocItems = $("#toc a");
|
402 | 402 | for (let i = 0; i < tocItems.length; i++) {
|
403 |
| - tocItems[i].classList.remove("toc-active") |
404 |
| - } |
| 403 | + tocItems[i].classList.remove("toc-active"); |
| 404 | + }; |
| 405 | + tocItems[0].classList.add("toc-active"); |
405 | 406 | };
|
406 |
| - tocItems[0].classList.add("toc-active"); |
407 | 407 | })
|
408 | 408 | </script>
|
409 | 409 |
|
| 410 | + <!-- adjust alerts on mobile --> |
| 411 | + <script type="text/javascript"> |
| 412 | + window.addEventListener("wheel", () => { |
| 413 | + if (window.innerWidth < 1425) { |
| 414 | + //adjust alert |
| 415 | + if(window.pageYOffset > 0) { |
| 416 | + document.querySelector('#support-alert').style.position = "fixed"; |
| 417 | + document.querySelector('#support-alert').style.bottom = "0px"; |
| 418 | + document.querySelector('#support-alert').style.margin = "5px"; |
| 419 | + document.querySelector('#support-alert').style.zIndex = "9999999"; |
| 420 | + } |
| 421 | + } |
| 422 | + }); |
| 423 | + window.addEventListener('resize', () => { |
| 424 | + if (window.innerWidth >= 1425) { |
| 425 | + document.querySelector('#support-alert').style.removeProperty('position'); |
| 426 | + document.querySelector('#support-alert').style.removeProperty('bottom'); |
| 427 | + document.querySelector('#support-alert').style.removeProperty('margin'); |
| 428 | + document.querySelector('#support-alert').style.removeProperty('zIndex'); |
| 429 | + } |
| 430 | + }) |
| 431 | + </script> |
| 432 | + |
410 | 433 | </body>
|
411 | 434 |
|
412 | 435 | </html>
|
0 commit comments