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();
+ });
});