Skip to content

Commit

Permalink
Merge pull request #183 from dosource/master
Browse files Browse the repository at this point in the history
Don't scroll up the dropdown if unnecessary
  • Loading branch information
brianreavis committed Nov 3, 2013
2 parents 2c3c960 + 7350e93 commit f8f38aa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/selectize.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ $.extend(Selectize.prototype, {
scroll_top = y;
scroll_bottom = y - height_menu + height_item;

if (y + height_item > height_menu - scroll) {
if (y + height_item > height_menu + scroll) {
self.$dropdown_content.stop().animate({scrollTop: scroll_bottom}, animate ? self.settings.scrollDuration : 0);
} else if (y < scroll) {
self.$dropdown_content.stop().animate({scrollTop: scroll_top}, animate ? self.settings.scrollDuration : 0);
Expand Down Expand Up @@ -1378,10 +1378,10 @@ $.extend(Selectize.prototype, {
var isFull = self.isFull();
var isLocked = self.isLocked;

this.$wrapper
self.$wrapper
.toggleClass('rtl', self.rtl);

this.$control
self.$control
.toggleClass('focus', self.isFocused)
.toggleClass('disabled', self.isDisabled)
.toggleClass('required', self.isRequired)
Expand All @@ -1393,7 +1393,7 @@ $.extend(Selectize.prototype, {
.toggleClass('has-options', !$.isEmptyObject(self.options))
.toggleClass('has-items', self.items.length > 0);

this.$control_input.data('grow', !isFull && !isLocked);
self.$control_input.data('grow', !isFull && !isLocked);
},

/**
Expand Down Expand Up @@ -1461,7 +1461,7 @@ $.extend(Selectize.prototype, {
self.$dropdown.css({visibility: 'hidden', display: 'block'});
self.positionDropdown();
self.$dropdown.css({visibility: 'visible'});
self.trigger('dropdown_open', this.$dropdown);
self.trigger('dropdown_open', self.$dropdown);
},

/**
Expand All @@ -1471,7 +1471,7 @@ $.extend(Selectize.prototype, {
var self = this;
var trigger = self.isOpen;

if (self.settings.mode === 'single' && this.items.length) {
if (self.settings.mode === 'single' && self.items.length) {
self.hideInput();
}

Expand Down

0 comments on commit f8f38aa

Please sign in to comment.