Skip to content

Commit a1273b6

Browse files
author
Le Wang
committed
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.
1 parent b562d1a commit a1273b6

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

select2.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ the specific language governing permissions and limitations under the Apache Lic
11761176
if (more.length === 0) return;
11771177
below = more.offset().top - results.offset().top - results.height();
11781178

1179-
if (below <= 0) {
1179+
if (below <= this.opts.loadMorePadding) {
11801180
more.addClass("select2-active");
11811181
this.opts.query({
11821182
term: term,
@@ -2411,6 +2411,7 @@ the specific language governing permissions and limitations under the Apache Lic
24112411
// plugin defaults, accessible to users
24122412
$.fn.select2.defaults = {
24132413
width: "copy",
2414+
loadMorePadding: 0,
24142415
closeOnSelect: true,
24152416
openOnEnter: true,
24162417
containerCss: {},

0 commit comments

Comments
 (0)