Avoid some processing while hidden - fixes placeholders on first load when the widget is hidden

This commit is contained in:
Nathan Gray 2016-03-08 22:11:58 +00:00
parent 0f5d4e7cab
commit e902c32d9f

View File

@ -966,7 +966,7 @@
$(window).resize($.proxy(handlers._onWindowResized, this));
// do not perform an initial call if we are using ajax unless we have initial values
if(cfg.value !== null || cfg.data !== null){
if((cfg.value !== null || cfg.data !== null) && ms.container.is(':visible')){
if(typeof(cfg.data) === 'string'){
self._asyncValues = cfg.value;
self._processSuggestions();
@ -1082,7 +1082,7 @@
});
ms._valueContainer.appendTo(ms.selectionContainer);
if(cfg.selectionPosition === 'inner' && !cfg.selectionContainer) {
if(cfg.selectionPosition === 'inner' && !cfg.selectionContainer && ms.container.is(':visible')) {
ms.input.width(0);
inputOffset = ms.input.offset().left - ms.selectionContainer.offset().left;
w = ms.container.width() - inputOffset - 42;