|
442 | 442 | toc = document.querySelector('#toc') |
443 | 443 | main = document.querySelector('.main') |
444 | 444 | okd_footer = document.querySelector('.footer-origin-docs') |
| 445 | + |
| 446 | + //handle short pages |
| 447 | + if (window.innerHeight === document.documentElement.scrollHeight) { |
| 448 | + //sidebar |
| 449 | + if (sidebar !== null && okd_footer == null) { |
| 450 | + sidebar.style.marginBottom = "38px"; |
| 451 | + main.style.marginBottom = "35px"; |
| 452 | + }; |
| 453 | + //okd sidebar |
| 454 | + if(sidebar !== null && okd_footer !== null) { |
| 455 | + sidebar.style.marginBottom = "176px"; |
| 456 | + main.style.marginBottom = "135px"; |
| 457 | + } |
| 458 | + }; |
| 459 | + |
| 460 | + //handle scrolling pages |
445 | 461 | document.addEventListener('scroll', () => { |
446 | 462 | //scroll to bottom |
447 | 463 | if (window.innerWidth >= 1008) { |
448 | | - if(sidebar !== null && toc !== null) { |
| 464 | + if(sidebar !== null) { |
| 465 | + //pages with multiple toc entries |
449 | 466 | if(document.documentElement.scrollHeight === window.pageYOffset + window.innerHeight) { |
450 | | - sidebar.style.marginBottom = "38px"; |
451 | | - toc.style.bottom = "35px"; |
452 | | - main.style.marginBottom = "35px"; |
453 | | - //okd footer |
454 | | - if(okd_footer !== null) { |
| 467 | + //sidebar |
| 468 | + if (sidebar !== null && okd_footer == null){ |
| 469 | + sidebar.style.marginBottom = "38px"; |
| 470 | + main.style.marginBottom = "35px"; |
| 471 | + }; |
| 472 | + //toc |
| 473 | + if (toc !== null && okd_footer == null){ |
| 474 | + toc.style.bottom = "35px"; |
| 475 | + }; |
| 476 | + //okd sidebar |
| 477 | + if(sidebar !== null && okd_footer !== null) { |
455 | 478 | sidebar.style.marginBottom = "176px"; |
456 | | - toc.style.bottom = "175px"; |
457 | 479 | main.style.marginBottom = "135px"; |
458 | 480 | }; |
| 481 | + //okd toc |
| 482 | + if (toc !== null && okd_footer !== null){ |
| 483 | + toc.style.bottom = "175px"; |
| 484 | + }; |
459 | 485 | }; |
460 | 486 | if(document.documentElement.scrollHeight != window.pageYOffset + window.innerHeight) { |
461 | 487 | sidebar.style.marginBottom = "0px"; |
462 | | - toc.style.bottom = "0px"; |
| 488 | + if (toc !== null) { |
| 489 | + toc.style.bottom = "0px"; |
| 490 | + } |
463 | 491 | } |
464 | 492 | } |
465 | 493 | } |
|
0 commit comments