mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-11-25 06:07:45 +00:00
Cleanup white space, update code styling and naming.
This commit is contained in:
parent
da54bac1ed
commit
dc34d70831
@ -138,8 +138,7 @@
|
||||
suggestionSelector = '.' + that.classes.suggestion,
|
||||
selected = that.classes.selected,
|
||||
options = that.options,
|
||||
container,
|
||||
noSuggestionsContainer;
|
||||
container;
|
||||
|
||||
// Remove autocomplete attribute to prevent native suggestions:
|
||||
that.element.setAttribute('autocomplete', 'off');
|
||||
@ -276,34 +275,37 @@
|
||||
if (orientation == 'auto') {
|
||||
var viewPortHeight = $(window).height(),
|
||||
scrollTop = $(window).scrollTop(),
|
||||
top_overflow = -scrollTop + offset.top - containerHeight,
|
||||
bottom_overflow = scrollTop + viewPortHeight - (offset.top + height + containerHeight);
|
||||
topOverflow = -scrollTop + offset.top - containerHeight,
|
||||
bottomOverflow = scrollTop + viewPortHeight - (offset.top + height + containerHeight);
|
||||
|
||||
if (Math.max(top_overflow, bottom_overflow) === top_overflow)
|
||||
orientation = 'top';
|
||||
else
|
||||
orientation = 'bottom';
|
||||
orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow)
|
||||
? 'top'
|
||||
: 'bottom';
|
||||
}
|
||||
|
||||
if (orientation === 'top')
|
||||
if (orientation === 'top') {
|
||||
styles.top += -containerHeight;
|
||||
else
|
||||
styles.top += height;
|
||||
} else {
|
||||
styles.top += height;
|
||||
}
|
||||
|
||||
// If container is not positioned to body,
|
||||
// correct its position using offset parent offset
|
||||
if(containerParent !== document.body) {
|
||||
var opacity = $container.css('opacity'),
|
||||
parentOffsetDiff;
|
||||
if (!that.visible)
|
||||
$container.css('opacity', 0).show();
|
||||
|
||||
if (!that.visible){
|
||||
$container.css('opacity', 0).show();
|
||||
}
|
||||
|
||||
parentOffsetDiff = $container.offsetParent().offset();
|
||||
styles.top -= parentOffsetDiff.top;
|
||||
styles.left -= parentOffsetDiff.left;
|
||||
|
||||
if (!that.visible)
|
||||
if (!that.visible){
|
||||
$container.css('opacity', opacity).hide();
|
||||
}
|
||||
}
|
||||
|
||||
// -2px to account for suggestions border.
|
||||
@ -611,8 +613,7 @@
|
||||
noSuggestionsContainer = $(that.noSuggestionsContainer),
|
||||
beforeRender = options.beforeRender,
|
||||
html = '',
|
||||
index,
|
||||
width;
|
||||
index;
|
||||
|
||||
if (options.triggerSelectOnValidInput) {
|
||||
index = that.findSuggestionIndex(value);
|
||||
@ -731,10 +732,12 @@
|
||||
|
||||
validateOrientation: function(orientation, fallback) {
|
||||
orientation = $.trim(orientation || '').toLowerCase();
|
||||
|
||||
if($.inArray(orientation, ['auto', 'bottom', 'top']) === -1){
|
||||
orientation = fallback;
|
||||
}
|
||||
return orientation
|
||||
|
||||
return orientation;
|
||||
},
|
||||
|
||||
processResponse: function (result, originalQuery, cacheKey) {
|
||||
|
Loading…
Reference in New Issue
Block a user