4,090
edits
No edit summary |
No edit summary |
||
Line 31: | Line 31: | ||
// Attach a click event listener to close the fixed column | // Attach a click event listener to close the fixed column | ||
$('#show-article').on('click', function () { | $('#show-article').on('click', function (event) { | ||
// Hide the fixed column when clicked outside | // Hide the fixed column when clicked outside or on the close button | ||
$('#show-article').css('display', 'none'); | if (event.target.id === 'close-button' || !$.contains(this, event.target)) { | ||
$('#show-article').css('display', 'none'); | |||
} | |||
}); | }); | ||
} else { | } else { |