[docs] handle incorrect hash in url (#10999)

* [docs] handle incorrect hash in url

* fix mistype
This commit is contained in:
Ivan Blinkov 2020-05-18 13:31:01 +03:00 committed by GitHub
parent 0fe723acc9
commit 528ac30a01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,9 +20,12 @@
var offset = 0;
if (selector !== '#') {
offset = $(selector).offset().top - $('#top-nav').height() * 1.5;
var destination = $(selector);
if (destination.length) {
offset = destination.offset().top - $('#top-nav').height() * 1.5;
dst += selector;
}
}
$('html, body').animate({
scrollTop: offset
}, 500);
@ -32,11 +35,14 @@
var top_nav = $('#top-nav.sticky-top');
if (window.location.hash.length > 1 && top_nav.length) {
var offset = $(window.location.hash).offset().top - top_nav.height() * 1.5;
var hash_destination = $(window.location.hash);
if (hash_destination.length) {
var offset = hash_destination.offset().top - top_nav.height() * 1.5;
$('html, body').animate({
scrollTop: offset
}, 70);
}
}
$('img').each(function() {
var src = $(this).attr('data-src');