有大约20-30K的选择选项我必须在循环中处理-我想要的是在循环处理时显示一个加载器.gif轮子。我可以看到它需要5-7秒!但我看不到方向盘?如果我在dev工具中放置一个断点,我会在所需的位置看到轮子。但是如果没有断点,就像循环死了一样,5秒后它会呈现选择框??这跟DOM有关系吗?
<img src="wheel.jpg" id="wheel" style="display:none;"/>
jquery->
$('#wheel').css({'display':'block'});
loop through a combo box and add or remove <options> from it (no XHR calls)
$('#wheel').css({'display':'none'});有没有人?
发布于 2014-06-04 23:01:23
$(function(){
// ensure the wheel is visible before starting the job
$('#wheel').fadeIn(500, function(){
var selects = $('select').size();
$('select').each(function(i, item){
//simulating the hard job...
var options = $(this).find('option').size();
$(this).find('option').each(function(i, item){
$(this).text('b');
if(options==i+1){
selects--;
}
});
// hiding the wheel when finished
if (0 == selects) {
$('#wheel').hide();
}
});
});
});https://stackoverflow.com/questions/24040243
复制相似问题