1
0
mirror of synced 2025-02-04 06:09:23 +03:00

tweak how mask is created to remove jitter. fixes #1574

This commit is contained in:
Igor Vaynberg 2013-07-31 21:41:29 -07:00
parent d479018485
commit e162a4802c
2 changed files with 16 additions and 27 deletions

View File

@ -114,25 +114,18 @@ Version: @@ver@@ Timestamp: @@timestamp@@
cursor: pointer;
}
.select2-drop-undermask {
border: 0;
margin: 0;
padding: 0;
position: absolute;
left: 0;
top: 0;
z-index: 9998;
background-color: transparent;
filter: alpha(opacity=0);
}
.select2-drop-mask {
border: 0;
margin: 0;
padding: 0;
position: absolute;
position: fixed;
left: 0;
top: 0;
min-height: 100%;
min-width: 100%;
height: auto;
width: auto;
opacity: 0;
z-index: 9998;
/* styles required for IE to work */
background-color: #fff;

View File

@ -1262,7 +1262,7 @@ the specific language governing permissions and limitations under the Apache Lic
if (self.opts.selectOnBlur) {
self.selectHighlighted({noFocus: true});
}
self.close();
self.close({focus:false});
e.preventDefault();
e.stopPropagation();
}
@ -1279,9 +1279,7 @@ the specific language governing permissions and limitations under the Apache Lic
this.dropdown.attr("id", "select2-drop");
// show the elements
maskCss=_makeMaskCss();
mask.css(maskCss).show();
mask.show();
this.dropdown.show();
this.positionDropdown();
@ -1293,18 +1291,11 @@ the specific language governing permissions and limitations under the Apache Lic
var that = this;
this.container.parents().add(window).each(function () {
$(this).on(resize+" "+scroll+" "+orient, function (e) {
var maskCss=_makeMaskCss();
$("#select2-drop-mask").css(maskCss);
that.positionDropdown();
});
});
function _makeMaskCss() {
return {
width : Math.max(document.documentElement.scrollWidth, $(window).width()),
height : Math.max(document.documentElement.scrollHeight, $(window).height())
}
}
},
// abstract
@ -1835,11 +1826,16 @@ the specific language governing permissions and limitations under the Apache Lic
},
// single
close: function () {
close: function (params) {
if (!this.opened()) return;
this.parent.close.apply(this, arguments);
params = params || {focus: true};
this.focusser.removeAttr("disabled");
this.focusser.focus();
if (params.focus) {
this.focusser.focus();
}
},
// single