javascript - Use lazy loading on bootstrap typeahaead dropdown -
i have custom template dropdown(combobox) of bootstrap typeahead having 940 elements each element having images well.
so page load have show elements available in dropdown-combobox after if user type in result filtered.
is there way can use lazy load or other functionality improve performance time of load when have show 940 elements.
code :
$('#scrollable-dropdown-menu .typeahead').typeahead({"highlight":true}, { name: 'fabrics', limit: 940, minlength: 0, display: function(){ return ''; }, source: substringmatcher(fabrics), templates: { header: function(){ if(selectedfabric) return selectedfabric }, empty: [ '<div class="empty-message">', 'no match found', '</div>' ].join('\n'), suggestion: function(query, context){ option = '<div class="typerow"><span class="imgblock"><img src="../../../styles/images/fabric/' + query.text.imgname + '" alt="image not found" /></span><div class="desc"><p class="phead"> ' + query.text.fabriccolor + ' ' + query.text.openness + ' </p><p class="pmodel"><span class="mdl"><small>model:</small>' + query.text.id +'</span> <span class="smple"><small>sample:</small>'+ query.text.sample +'</span></p></div></div>'; return option; } } });
Comments
Post a Comment