diff options
author | Jakob Odersky <jakob@odersky.com> | 2017-12-03 13:23:29 -0800 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2017-12-03 13:23:29 -0800 |
commit | c788585aa58b6b5474e608e8a4f9725403814444 (patch) | |
tree | 93cb9e19fb10002a1d0a4a79b19db3efcf199843 /documentation/4.1/api/lib/index.js | |
parent | 25e6ce0498dee68b2932a459a40056bbafcdfc9e (diff) | |
download | akka-serial-c788585aa58b6b5474e608e8a4f9725403814444.tar.gz akka-serial-c788585aa58b6b5474e608e8a4f9725403814444.tar.bz2 akka-serial-c788585aa58b6b5474e608e8a4f9725403814444.zip |
Update documentation to version 4.1.2
Diffstat (limited to 'documentation/4.1/api/lib/index.js')
-rw-r--r-- | documentation/4.1/api/lib/index.js | 26 |
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); + } } }; |