Site main.js: skip nav anchors without href in scroll handler; the Categories dropdown toggle has none, so every scroll threw TypeError and aborted sticky-header/header-appear logic
This commit is contained in:
1 parent
c274e6dcd9
commit
b189281a1b
1 file changed
+6
-2
@@ -43,9 +43,13 @@
|
|||||||
scrollPos = scrollPos + 60;
|
scrollPos = scrollPos + 60;
|
||||||
menu_links.each(function () {
|
menu_links.each(function () {
|
||||||
var currLink = $(this);
|
var currLink = $(this);
|
||||||
var hasPos = currLink.attr("href").indexOf("#");
|
var href = currLink.attr("href");
|
||||||
|
if (!href) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var hasPos = href.indexOf("#");
|
||||||
if (hasPos > -1) {
|
if (hasPos > -1) {
|
||||||
var res = currLink.attr("href").substring(hasPos);
|
var res = href.substring(hasPos);
|
||||||
if (res != '' && res != '#' && $(res).length > 0) {
|
if (res != '' && res != '#' && $(res).length > 0) {
|
||||||
var refElement = $(res);
|
var refElement = $(res);
|
||||||
if (refElement.offset().top <= scrollPos && refElement.offset().top + refElement.height() > scrollPos) {
|
if (refElement.offset().top <= scrollPos && refElement.offset().top + refElement.height() > scrollPos) {
|
||||||
|
|||||||
Reference in new issue
Block a user