fixing closing button issue

This commit is contained in:
Tobi 2025-06-20 22:36:28 +02:00
parent 98c356b201
commit 46fe5ab719

View file

@ -289,24 +289,21 @@
var $this = $(this); var $this = $(this);
// Close. // Handle the × button click and touchend for mobile compatibility
$('<div class="close">Close</div>') $this.find('button.close').each(function() {
.appendTo($this) var closeHandler = function(event) {
.on('click', function() {
location.hash = '';
});
// Handle the × button click
$this.find('button.close').on('click', function(event) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
location.hash = ''; location.hash = '';
}); };
$(this).on('click', closeHandler);
$(this).on('touchend', closeHandler);
});
// Prevent clicks from inside article from bubbling. // Prevent clicks from inside article from bubbling.
$this.on('click', function(event) { $this.on('click', function(event) {
event.stopPropagation(); event.stopPropagation();
}); });
}); });