Skip to content

Commit

Permalink
Fix sort problem when scroll in <html> (fix #21)
Browse files Browse the repository at this point in the history
  • Loading branch information
La Marciana committed Jan 21, 2012
1 parent 84bdfcb commit 912a2e2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ The newly created select default option is the original select title attribute:
* [Victor Berchet](http://github.com/vicb) is the author of bsmSelect
* [Andy Fowler](http://github.com/andyfowler) has contributed many enhancements
* [Cracky](https://github.com/Cracky)
* [Marc Busqué](https://github.com/laMarciana) has contributed to fix [issue #21](https://github.com/vicb/bsmSelect/issues/21) and with minimal CSS

## History ##

Expand Down
5 changes: 5 additions & 0 deletions css/jquery.bsmselect.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,8 @@
top: 0;
padding: 5px;
}

.bsmScrollWorkaround {
padding-bottom: 1px;
overflow: auto;
}
7 changes: 6 additions & 1 deletion history.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# bsmSelect #

v1.4.4 - 2012-01-19

* Fix issue #21, that's the scroll problem, adding the css class '.bsmScrollWorkaround' and applying it with js when needed
* Minimal CSS modification: set width to auto in list items

v1.4.3 - 2011-05-05

* Fix the position when appending to the list (GH-9)
Expand Down Expand Up @@ -89,4 +94,4 @@ v1.0.1 - 2011-11-14

v1.0.0 - 2010-09-05

* intial release
* intial release
7 changes: 5 additions & 2 deletions js/jquery.bsmselect.sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
*
* version: v1.1.2 - 2011-11-14
* version: v1.4.4 - 2012-01-19
*/
(function($) {
$.bsmSelect.plugins.sortable = function(sortConfig, options)
Expand All @@ -27,6 +27,10 @@
config = $.extend({}, this.sortConfig, { items: '.' + o.listItemClass }),
self = this;
bsm.$list.addClass(o.listSortableClass).sortable(config);
//If statement to fix bug when html element has an overflow set to scroll or auto. Issues #21 (https://github.com/vicb/bsmSelect/issues/21) and #22 (https://github.com/vicb/bsmSelect/pull/22)
if ($.inArray($('html').css('overflow-x'), ['auto', 'scroll']) > -1 || $.inArray($('html').css('overflow-y'), ['auto', 'scroll']) > -1) {
$('.' + o.listSortableClass).addClass('bsmScrollWorkaround');
}
bsm.$original.bind('change', function(e, info) { self.onChange.call(self, bsm, e, info); } );
bsm.$list.bind('sortupdate', function(e, ui) { self.onSort.call(self, bsm, e, ui); } );
},
Expand All @@ -46,4 +50,3 @@
}
});
})(jQuery);

0 comments on commit 912a2e2

Please sign in to comment.