hel*_*ing 5 jquery jquery-ui jquery-ui-button
我有4个按钮使用Jquery UI的"按钮"功能.3完美无瑕地工作.第四个似乎并不想总是应用jquery ui悬停类"ui-state-hover"悬停时.它有一些时间,但大部分时间它只应用一个"悬停"类(我在萤火虫中观看它),这显然与他们的CSS样式不匹配.有没有人知道导致这种差异的原因是什么?
编辑:我认为这是UI按钮和Ajax上传器之间的冲突.这是我正在使用的一些修剪过的代码.
$('.upload_img').button({
icons: {
primary: 'ui-icon-folder-open'
},
label: "Browse"
})
jQuery('.upload_img').each(function(){
var button = jQuery(this);
var ID = jQuery(this).attr('value');
var container = jQuery(this).parent();
//prevent the clicks from its default 'form submit' behavior
$(this).click(function() {
return false;
});
new AjaxUpload( button, {
action: ajaxurl,
name: ID , // File upload name
data: { // Additional data to send
action: 'save_function',
type: 'upload',
_nonce: '<?php echo $nonce; ?>',
key: ID },
onSubmit: function(file , ext){
this.disable(); // If you want to allow uploading only 1 file at time, you can disable upload button
},
onComplete: function(file, response) {
this.enable(); // re-enable upload button
if(response == 99){
//alert(response);
show_message(5); // failure
t = setTimeout('fade_message()', 2000);
}
// If there was not an error
else{
show_message(4); // success
t = setTimeout('fade_message()', 2000);
}
}
});
});
Run Code Online (Sandbox Code Playgroud)