Skip to content

Commit

Permalink
fix for dropdown closing as soon as its opened in IE8. fixes #369. fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ivaynberg committed Sep 11, 2012
1 parent b4371aa commit 96657a1
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions select2.js
Original file line number Diff line number Diff line change
Expand Up @@ -972,13 +972,18 @@
});
});

$(window).bind(resize, function() {
var s2 = $(selector);
if (s2.length == 0) {
$(window).unbind(resize);
}
s2.select2("close");
});
window.setTimeout(function() {
// this is done inside a timeout because IE will sometimes fire a resize event while opening
// the dropdown and that causes this handler to immediately close it. this way the dropdown
// has a chance to fully open before we start listening to resize events
$(window).bind(resize, function() {
var s2 = $(selector);
if (s2.length == 0) {
$(window).unbind(resize);
}
s2.select2("close");
})
}, 10);

this.clearDropdownAlignmentPreference();

Expand Down

0 comments on commit 96657a1

Please sign in to comment.