From 46fe5ab7195aae2f4b94bdb05eec8f96bbe48362 Mon Sep 17 00:00:00 2001 From: Tobi Date: Fri, 20 Jun 2025 22:36:28 +0200 Subject: [PATCH] fixing closing button issue --- assets/js/main.js | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/assets/js/main.js b/assets/js/main.js index 4df2b0a..9c95abc 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -289,24 +289,21 @@ var $this = $(this); - // Close. - $('
Close
') - .appendTo($this) - .on('click', function() { - location.hash = ''; - }); - - // Handle the × button click - $this.find('button.close').on('click', function(event) { + // Handle the × button click and touchend for mobile compatibility + $this.find('button.close').each(function() { + var closeHandler = function(event) { event.preventDefault(); event.stopPropagation(); location.hash = ''; - }); + }; + $(this).on('click', closeHandler); + $(this).on('touchend', closeHandler); + }); // Prevent clicks from inside article from bubbling. - $this.on('click', function(event) { - event.stopPropagation(); - }); + $this.on('click', function(event) { + event.stopPropagation(); + }); });