Javascript 通过start()函数而不是show()元素添加throbber
此代码添加了一个gif抖动器:Javascript 通过start()函数而不是show()元素添加throbber,javascript,jquery,throbber,Javascript,Jquery,Throbber,此代码添加了一个gif抖动器: function glitch_player_display(arg1,arg2) { jQuery('#loader').show(); // show loading... jQuery.ajax({ type: 'POST', url: ajaxglitch_playerajax.ajaxurl, data: { action: 'ajaxglitch_playe
function glitch_player_display(arg1,arg2) {
jQuery('#loader').show(); // show loading...
jQuery.ajax({
type: 'POST',
url: ajaxglitch_playerajax.ajaxurl,
data: {
action: 'ajaxglitch_player_ajaxhandler',
arg1: arg1,
arg2: arg2
},
success: function(data, textStatus, XMLHttpRequest) {
$('#loader').hide();
var loadpostresult = '#showglitchplayer';
jQuery(showglitchplayer).html('');
jQuery(showglitchplayer).append(data);
},
error: function(MLHttpRequest, textStatus, errorThrown) {
alert(errorThrown);
}
});
}
以及HTML:
<img src="js/ajax-loader.gif" id="loader" style="display:none;"/>
HTML
<div id="t1" class="throb"></div>
js代码被添加到.js文档中,我在控制台中没有收到任何错误,但也没有throbber。我叫错了吗?一旦它被正确调用,那么
$(“#loader”).hide()的等价物将是什么呢?这里是throbber!它一直在那里。白色背景中的白色悸动者。躲藏
停止它需要添加throb.stop()代码>在成功时:
(其中$(“#加载程序”).hide();
在上面的代码中)
strobber.js很可爱
<div id="t1" class="throb"></div>