Skip to content

Commit

Permalink
Update tiny-autocomplete.js
Browse files Browse the repository at this point in the history
Do not need use ES6 features.
  • Loading branch information
User756675678 authored Mar 6, 2020
1 parent b65e6af commit 2f74495
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/tiny-autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,20 +151,20 @@ var factory = function($, window) {
);

this.el.on("blur", ".autocomplete-field", $.proxy(this.closeList, this));

var self = this;
// Update maxItems when window size change
$(window).resize(
this.debounce(() => {
this.debounce(function() {
if (
window.innerWidth < this.settings.mobileWidth &&
this.settings.maxItemsOnMobile !== null
window.innerWidth < self.settings.mobileWidth &&
self.settings.maxItemsOnMobile !== null
) {
this.settings.maxItems = Math.min(
this.settings.maxItems,
this.settings.maxItemsOnMobile
self.settings.maxItems = Math.min(
self.settings.maxItems,
self.settings.maxItemsOnMobile
);
} else {
this.settings.maxItems = this.settings.maxItemsOnLarge;
self.settings.maxItems = self.settings.maxItemsOnLarge;
}
}, 250)
);
Expand Down

0 comments on commit 2f74495

Please sign in to comment.