Skip to content

Commit

Permalink
(fix) Use proper event object for handlers in IE
Browse files Browse the repository at this point in the history
`event` and `event.target` are not provided in IE8.
This fixes the bugs with not hiding the overlay on background click
and not working keyboard shortcuts.
  • Loading branch information
feimosi committed Mar 11, 2017
1 parent 7a39ba5 commit f1b5484
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/baguetteBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,12 @@
element.addEventListener(event, callback, useCapture);
} else {
// IE8 fallback
element.attachEvent('on' + event, callback);
element.attachEvent('on' + event, function(event) {
// `event` and `event.target` are not provided in IE8
event = event || window.event;
event.target = event.target || event.srcElement;
callback(event);
});
}
}

Expand Down

0 comments on commit f1b5484

Please sign in to comment.