| ... | ... |
@@ -98,4 +98,34 @@ function Onepage(list, options) {
|
| 98 | 98 |
articles.forEach ((article) => {
|
| 99 | 99 |
articleObserver.observe(article); |
| 100 | 100 |
}); |
| 101 |
+ |
|
| 102 |
+ |
|
| 103 |
+ /** AldeGott Section Scroller **/ |
|
| 104 |
+ document.addEventListener("DOMContentLoaded", function() {
|
|
| 105 |
+ |
|
| 106 |
+ window.scrollToNextSection = function () {
|
|
| 107 |
+ let sections = document.querySelectorAll('#main .inside > .mod_article, #footer');
|
|
| 108 |
+ var section; |
|
| 109 |
+ |
|
| 110 |
+ for (let i = 0; i < sections.length; i++) |
|
| 111 |
+ {
|
|
| 112 |
+ section = sections[i]; |
|
| 113 |
+ let boundingArea = section.getBoundingClientRect(); |
|
| 114 |
+ let viewportTrigger = window.innerHeight; |
|
| 115 |
+ |
|
| 116 |
+ if (boundingArea.top < viewportTrigger-15) |
|
| 117 |
+ {
|
|
| 118 |
+ continue; |
|
| 119 |
+ } |
|
| 120 |
+ |
|
| 121 |
+ scrollTo({
|
|
| 122 |
+ top: getOffsetTop(section), |
|
| 123 |
+ behavior: "smooth" |
|
| 124 |
+ }); |
|
| 125 |
+ break; |
|
| 126 |
+ } |
|
| 127 |
+ return section; |
|
| 128 |
+ } |
|
| 129 |
+ |
|
| 130 |
+ }); |
|
| 101 | 131 |
}; |
| ... | ... |
@@ -195,43 +195,6 @@ |
| 195 | 195 |
|
| 196 | 196 |
</script> |
| 197 | 197 |
|
| 198 |
-<script> |
|
| 199 |
- document.addEventListener("DOMContentLoaded", function() {
|
|
| 200 |
- |
|
| 201 |
- window.scrollToNextSection = function () {
|
|
| 202 |
- let sections = document.querySelectorAll('#main .inside > .mod_article, #footer');
|
|
| 203 |
- var section; |
|
| 204 |
- |
|
| 205 |
- for (let i = 0; i < sections.length; i++) |
|
| 206 |
- {
|
|
| 207 |
- section = sections[i]; |
|
| 208 |
- let boundingArea = section.getBoundingClientRect(); |
|
| 209 |
- let viewportTrigger = window.innerHeight; |
|
| 210 |
- |
|
| 211 |
- if (boundingArea.top < viewportTrigger-15) |
|
| 212 |
- {
|
|
| 213 |
- continue; |
|
| 214 |
- } |
|
| 215 |
- |
|
| 216 |
- scrollTo({
|
|
| 217 |
- top: getOffsetTop(section), |
|
| 218 |
- behavior: "smooth" |
|
| 219 |
- }); |
|
| 220 |
- break; |
|
| 221 |
- } |
|
| 222 |
- return section; |
|
| 223 |
- } |
|
| 224 | 198 |
|
| 225 |
- function getOffsetTop(element,offset=0) {
|
|
| 226 |
- let offsetTop = 0; |
|
| 227 |
- while(element) {
|
|
| 228 |
- offsetTop += element.offsetTop; |
|
| 229 |
- element = element.offsetParent; |
|
| 230 |
- } |
|
| 231 |
- return offsetTop-offset; |
|
| 232 |
- } |
|
| 233 |
- |
|
| 234 |
- }); |
|
| 235 |
-</script> |
|
| 236 | 199 |
|
| 237 | 200 |
<?php $this->endblock(); ?> |