We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f41307e commit 8ef83d3Copy full SHA for 8ef83d3
intro.js
@@ -535,14 +535,15 @@
535
536
if (!_elementInViewport(targetElement.element)) {
537
var rect = targetElement.element.getBoundingClientRect(),
538
- top = rect.bottom - (rect.bottom - rect.top),
539
- bottom = rect.bottom - _getWinSize().height;
+ winHeight=_getWinSize().height,
+ top = rect.bottom - (rect.bottom - rect.top),
540
+ bottom = rect.bottom - winHeight;
541
542
// Scroll up
- if (top < 0) {
543
+ if (top < 0 || targetElement.element.clientHeight > winHeight) {
544
window.scrollBy(0, top - 30); // 30px padding from edge to look nice
545
- // Scroll down
546
+ // Scroll down
547
} else {
548
window.scrollBy(0, bottom + 100); // 70px + 30px padding from edge to look nice
549
}
0 commit comments