此代码添加了gif throbber:
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;"/>不过,我想使用这个按功能跳动
这就是我正在尝试的代码
function glitch_player_display(arg1,arg2) {
var throb = Throbber();
throb.appendTo( document.getElementById( 't1' ) );
throb.start();
jQuery.ajax({//etc as aboveHTML
<div id="t1" class="throb"></div>throbber.js代码被添加到.js文档中,在控制台中没有任何错误,但也没有throbber。我说的不对吗?一旦它被正确调用,什么是$('#loader').hide()的等价物?
发布于 2014-05-30 05:24:06
那是跳跳的!它一直都在那里。在白色背景下的白色颤音者。躲起来。
停止它是一个在success:上添加success:的问题(在上面的代码中,$('#loader').hide();在这里)。
Throbber.js很甜。
https://stackoverflow.com/questions/23947398
复制相似问题