aboutsummaryrefslogtreecommitdiff
path: root/documentation/4.1/api/lib/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/4.1/api/lib/index.js')
-rw-r--r--documentation/4.1/api/lib/index.js26
1 files changed, 16 insertions, 10 deletions
diff --git a/documentation/4.1/api/lib/index.js b/documentation/4.1/api/lib/index.js
index 1a2e62b..087c975 100644
--- a/documentation/4.1/api/lib/index.js
+++ b/documentation/4.1/api/lib/index.js
@@ -113,20 +113,26 @@ function handleKeyNavigation() {
scroller.container = $container;
scroller.scrollDown = function($elem) {
- var yPos = $elem.offset().top; // offset relative to viewport
- if ($container.height() < yPos || (yPos - $("#search").height()) < 0) {
- $container.animate({
- scrollTop: $container.scrollTop() + yPos - $("#search").height() - 10
- }, 200);
+ var offset = $elem.offset(); // offset relative to viewport
+ if (offset !== undefined) {
+ var yPos = offset.top;
+ if ($container.height() < yPos || (yPos - $("#search").height()) < 0) {
+ $container.animate({
+ scrollTop: $container.scrollTop() + yPos - $("#search").height() - 10
+ }, 200);
+ }
}
};
scroller.scrollUp = function ($elem) {
- var yPos = $elem.offset().top; // offset relative to viewport
- if (yPos < $("#search").height()) {
- $container.animate({
- scrollTop: $container.scrollTop() + yPos - $("#search").height() - 10
- }, 200);
+ var offset = $elem.offset(); // offset relative to viewport
+ if (offset !== undefined) {
+ var yPos = offset.top;
+ if (yPos < $("#search").height()) {
+ $container.animate({
+ scrollTop: $container.scrollTop() + yPos - $("#search").height() - 10
+ }, 200);
+ }
}
};