diff --git a/docs/source/_static/custom.js b/docs/source/_static/custom.js deleted file mode 100644 index d0cd5d7..0000000 --- a/docs/source/_static/custom.js +++ /dev/null @@ -1,25 +0,0 @@ -document.addEventListener('DOMContentLoaded', function() { - // Select all navigation links within the .wy-main-nav container - var navLinks = document.querySelectorAll('.wy-main-nav .wy-main-nav-link'); - - // Function to remove 'active' class from all links - function removeActiveClass() { - navLinks.forEach(function(link) { - link.classList.remove('active'); - }); - } - - // Add click event listener to each link - navLinks.forEach(function(link) { - link.addEventListener('click', function(event) { - // Prevent the default link action - event.preventDefault(); - - // Remove 'active' class from all links - removeActiveClass(); - - // Add 'active' class to the clicked link - event.target.classList.add('active'); - }); - }); -}); \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 7785b31..0b5d3c9 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -25,13 +25,6 @@ "https://kedro.org/images/favicon.ico", ] -# Add the relative path from your conf.py file to the assets directory to html_static_path -html_static_path = ['_static'] - -# Include custom.js in the HTML output -html_js_files = [ - 'custom.js', -] templates_path = ["_templates"] diff --git a/src/kedro_sphinx_theme/theme/kedro-sphinx-theme/layout.html b/src/kedro_sphinx_theme/theme/kedro-sphinx-theme/layout.html index 5ea87b8..3e41ade 100644 --- a/src/kedro_sphinx_theme/theme/kedro-sphinx-theme/layout.html +++ b/src/kedro_sphinx_theme/theme/kedro-sphinx-theme/layout.html @@ -65,6 +65,30 @@ openBtn.dataset.toggle = 'wy-nav-top'; openBtn.classList.add('wy-nav-top-open'); document.querySelector('.wy-nav-top').prepend(openBtn); + + // Select all navigation links within the .wy-main-nav container + var navLinks = document.querySelectorAll('.wy-main-nav .wy-main-nav-link'); + + // Function to remove 'active' class from all links + function removeActiveClass() { + navLinks.forEach(function(link) { + link.classList.remove('active'); + }); + } + + // Add click event listener to each link + navLinks.forEach(function(link) { + link.addEventListener('click', function(event) { + // Prevent the default link action + event.preventDefault(); + + // Remove 'active' class from all links + removeActiveClass(); + + // Add 'active' class to the clicked link + event.target.classList.add('active'); + }); + }); }); {% endblock %}