Skip to content

Commit

Permalink
Fix custom js
Browse files Browse the repository at this point in the history
  • Loading branch information
BPerlakiH committed Jun 21, 2024
1 parent 1e3f9ce commit dae334f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Support/injection.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ let observer = new IntersectionObserver(function(entries) {
// register scroll view to handle heading on top of the page
window.onscroll = function() {
if (document.documentElement.scrollTop <= 0) {
window.webkit.messageHandlers.headingVisible.postMessage({id: headings[0].id})
const headingVisible = window.webkit.messageHandlers.headingVisible
if(headingVisible !== undefined && headingVisible.postMessage !== undefined) {
headingVisible.postMessage({id: headings[0].id})
}
}
}

Expand Down

0 comments on commit dae334f

Please sign in to comment.