I have a side pane that slides in from the left, adding content dynamically with get(). I want all clicks outside the pane to cause it to close by triggering a function. Based on other questions I read, I came up with the following code.
$('html').click(function() {
if (side_showing) {
close_side();
}
});
$(document).on("click", "#side", function(event) {
event.stopPropagation();
});
I can't seem to make it work. I know that the on()
function is being triggered, but event.stopPropagation
doesn't seem to be. Any tips?
stopPropagation();
? take a look javascripter.net/faq/eventbubbling.htm#demo – Hilliary