1
0
mirror of synced 2024-11-30 00:26:03 +03:00

better support orientation change on mobile. #782

This commit is contained in:
Igor Vaynberg 2013-01-31 16:45:26 -08:00
parent 300e99fcd5
commit 32249cc7f0

View File

@ -981,6 +981,7 @@ the specific language governing permissions and limitations under the Apache Lic
var cid = this.containerId, var cid = this.containerId,
scroll = "scroll." + cid, scroll = "scroll." + cid,
resize = "resize."+cid, resize = "resize."+cid,
orient = "orientationchange."+cid,
mask; mask;
this.clearDropdownAlignmentPreference(); this.clearDropdownAlignmentPreference();
@ -1020,7 +1021,7 @@ the specific language governing permissions and limitations under the Apache Lic
// attach listeners to events that can change the position of the container and thus require // attach listeners to events that can change the position of the container and thus require
// the position of the dropdown to be updated as well so it does not come unglued from the container // the position of the dropdown to be updated as well so it does not come unglued from the container
this.container.parents().add(window).each(function () { this.container.parents().add(window).each(function () {
$(this).bind(resize+" "+scroll, function (e) { $(this).bind(resize+" "+scroll+" "+orient, function (e) {
$("#select2-drop-mask").css({ $("#select2-drop-mask").css({
width:document.documentElement.scrollWidth, width:document.documentElement.scrollWidth,
height:document.documentElement.scrollHeight}); height:document.documentElement.scrollHeight});
@ -1037,10 +1038,11 @@ the specific language governing permissions and limitations under the Apache Lic
var cid = this.containerId, var cid = this.containerId,
scroll = "scroll." + cid, scroll = "scroll." + cid,
resize = "resize."+cid; resize = "resize."+cid,
orient = "orientationchange."+cid;
// unbind event listeners // unbind event listeners
this.container.parents().add(window).each(function () { $(this).unbind(scroll).unbind(resize); }); this.container.parents().add(window).each(function () { $(this).unbind(scroll).unbind(resize).unbind(orient); });
this.clearDropdownAlignmentPreference(); this.clearDropdownAlignmentPreference();