From a1273b639afb8c24e9c0b0492cbe62dcbbe416e9 Mon Sep 17 00:00:00 2001 From: Le Wang Date: Thu, 10 Jan 2013 17:02:00 +0800 Subject: [PATCH] add loadMorePadding option - Trigger load before scrolling to the very bottom. - When scrolling very fast, unless we pre-load entries, the page itself will scroll. --- select2.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/select2.js b/select2.js index 8a4e2093..8b593244 100644 --- a/select2.js +++ b/select2.js @@ -1176,7 +1176,7 @@ the specific language governing permissions and limitations under the Apache Lic if (more.length === 0) return; below = more.offset().top - results.offset().top - results.height(); - if (below <= 0) { + if (below <= this.opts.loadMorePadding) { more.addClass("select2-active"); this.opts.query({ term: term, @@ -2411,6 +2411,7 @@ the specific language governing permissions and limitations under the Apache Lic // plugin defaults, accessible to users $.fn.select2.defaults = { width: "copy", + loadMorePadding: 0, closeOnSelect: true, openOnEnter: true, containerCss: {},