Skip to content

Commit f1b5484

Browse files
committed
(fix) Use proper event object for handlers in IE
`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.
1 parent 7a39ba5 commit f1b5484

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/baguetteBox.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,12 @@
663663
element.addEventListener(event, callback, useCapture);
664664
} else {
665665
// IE8 fallback
666-
element.attachEvent('on' + event, callback);
666+
element.attachEvent('on' + event, function(event) {
667+
// `event` and `event.target` are not provided in IE8
668+
event = event || window.event;
669+
event.target = event.target || event.srcElement;
670+
callback(event);
671+
});
667672
}
668673
}
669674

0 commit comments

Comments
 (0)