refactoring

This commit is contained in:
Roland Gruber 2019-07-24 21:32:25 +02:00
parent 29a7b0c3e0
commit 778fde3357
1 changed files with 27 additions and 18 deletions

View File

@ -1120,6 +1120,16 @@ window.lam.dynamicSelect.activate = function() {
var dynamicSelects = jQuery('.lam-dynamicOptions'); var dynamicSelects = jQuery('.lam-dynamicOptions');
dynamicSelects.each(function() { dynamicSelects.each(function() {
var selectField = jQuery(this); var selectField = jQuery(this);
window.lam.dynamicSelect.initSelect(selectField);
});
}
/**
* Sets up a select field for dynamic scrolling.
*
* @param selectField select
*/
window.lam.dynamicSelect.initSelect = function(selectField) {
selectField.data('option-height', selectField.find("option").height()); selectField.data('option-height', selectField.find("option").height());
selectField.data('select-height', selectField.height()); selectField.data('select-height', selectField.height());
selectField.data('select-last-scroll-top', 0); selectField.data('select-last-scroll-top', 0);
@ -1138,7 +1148,6 @@ window.lam.dynamicSelect.activate = function() {
window.lam.dynamicSelect.onScroll(selectField, event, maxOptions, numOfOptionBeforeToLoadNextSet, numberOfOptionsToLoad); window.lam.dynamicSelect.onScroll(selectField, event, maxOptions, numOfOptionBeforeToLoadNextSet, numberOfOptionsToLoad);
}); });
} }
});
} }
/** /**