From b189281a1bec5e1c203621fe3e23822c61348095 Mon Sep 17 00:00:00 2001 From: kurogeek Date: Tue, 27 Oct 2026 02:07:59 +0000 Subject: [PATCH] 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 --- think.greaterchiangmai.com/public/js/main.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/think.greaterchiangmai.com/public/js/main.js b/think.greaterchiangmai.com/public/js/main.js index a92e608..8854dfd 100644 --- a/think.greaterchiangmai.com/public/js/main.js +++ b/think.greaterchiangmai.com/public/js/main.js @@ -43,9 +43,13 @@ scrollPos = scrollPos + 60; menu_links.each(function () { var currLink = $(this); - var hasPos = currLink.attr("href").indexOf("#"); + var href = currLink.attr("href"); + if (!href) { + return; + } + var hasPos = href.indexOf("#"); if (hasPos > -1) { - var res = currLink.attr("href").substring(hasPos); + var res = href.substring(hasPos); if (res != '' && res != '#' && $(res).length > 0) { var refElement = $(res); if (refElement.offset().top <= scrollPos && refElement.offset().top + refElement.height() > scrollPos) {