Skip to content

Commit

Permalink
Merge pull request #966 from djsmith42/master
Browse files Browse the repository at this point in the history
Fix mask height/width when document is shorter than window
  • Loading branch information
ivaynberg committed Mar 1, 2013
2 parents 66860b2 + 953b6f2 commit 3fe95ac
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions select2.js
Expand Up @@ -1121,9 +1121,7 @@ the specific language governing permissions and limitations under the Apache Lic
this.dropdown.attr("id", "select2-drop");

// show the elements
mask.css({
width: document.documentElement.scrollWidth,
height: document.documentElement.scrollHeight});
mask.css(_makeMaskCss());
mask.show();
this.dropdown.show();
this.positionDropdown();
Expand All @@ -1136,14 +1134,19 @@ the specific language governing permissions and limitations under the Apache Lic
var that = this;
this.container.parents().add(window).each(function () {
$(this).bind(resize+" "+scroll+" "+orient, function (e) {
$("#select2-drop-mask").css({
width:document.documentElement.scrollWidth,
height:document.documentElement.scrollHeight});
$("#select2-drop-mask").css(_makeMaskCss());
that.positionDropdown();
});
});

this.focusSearch();

function _makeMaskCss() {
return {
width : Math.max(document.documentElement.scrollWidth, $(window).width()),
height : Math.max(document.documentElement.scrollHeight, $(window).height())
}
}
},

// abstract
Expand Down

0 comments on commit 3fe95ac

Please sign in to comment.