Commit 9a912761 by Arjun Jhukal

updated the minor changes

parent 4256076a
......@@ -132,32 +132,63 @@
$(".category-list").removeClass("active");
});
const tocObserver = new IntersectionObserver(
function (entries) {
entries.forEach((entry) => {
if (entry.isIntersecting) {
$(".toc h6").show();
console.log("is intersecting")
} else {
$(".toc h6").hide();
console.log("is not intersecting")
}
});
},
{
threshold: 0.3,
},
);
// const tocObserver = new IntersectionObserver(
// function (entries) {
// entries.forEach((entry) => {
// if (entry.isIntersecting) {
// $(".toc h6").show();
// console.log("is intersecting")
// } else {
// $(".toc h6").hide();
// console.log("is not intersecting")
// }
// });
// },
// {
// threshold: 0.1,
// },
// );
// const sections = [
// document.querySelector(".BLOGDETAIL-LIST-ITEM-SECTION"),
// document.querySelector(".BLOGLISTING-LIST-ITEM-SECTION"),
// document.querySelector(".case-study-general"),
// ];
// sections.length &&
// sections.forEach((section) => {
// if (section) tocObserver.observe(section);
// });
const sections = [
document.querySelector(".BLOGDETAIL-LIST-ITEM-SECTION"),
document.querySelector(".BLOGLISTING-LIST-ITEM-SECTION"),
document.querySelector(".case-study-general"),
];
sections.length &&
sections.forEach((section) => {
if (section) tocObserver.observe(section);
});
// Filter out any null sections
const validSections = sections.filter(Boolean);
if (validSections.length) {
const handleScroll = () => {
const scrollTop = $(window).scrollTop();
const viewportHeight = $(window).height();
if (scrollTop > viewportHeight) {
$(".toc h6").show();
console.log("Scrolled past 100vh");
} else {
$(".toc h6").hide();
console.log("Above 100vh");
}
};
// Bind scroll event
$(window).on("scroll", handleScroll);
// Run on page load too
$(document).ready(handleScroll);
}
});
/** MOBILE OFFCANVAS TOC ENDS HERE */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment