diff --git a/static/js/hugo-academic.js b/static/js/hugo-academic.js index b8a7635a..42bd0d9e 100644 --- a/static/js/hugo-academic.js +++ b/static/js/hugo-academic.js @@ -89,7 +89,10 @@ * --------------------------------------------------------------------------- */ $(document).on('click', '.navbar-collapse.in', function(e) { - if ( $(e.target).is('a') && $(e.target).attr('class') != 'dropdown-toggle' ) { + //get the element that was clicked, even if the element that is inside the element is e.target + let targetElement = $(e.target).is('a') ? $(e.target) : $(e.target).parent(); + + if (targetElement.is('a') && targetElement.attr('class') != 'dropdown-toggle') { $(this).collapse('hide'); } }); @@ -164,7 +167,6 @@ * --------------------------------------------------------------------------- */ $(window).on('load', function() { - if (window.location.hash) { // When accessing homepage from another page and `#top` hash is set, show top of page (no hash). if (window.location.hash == "#top") {