代码之家  ›  专栏  ›  技术社区  ›  helgatheviking

jquery ui按钮悬停状态不一致

  •  5
  • helgatheviking  · 技术社区  · 16 年前

    我有4个按钮使用Jquery UI的“按钮”特性。3工作完美。第4个似乎不希望在悬停时始终应用jquery ui悬停类“ui state hover”。它有一些时候是这样做的,但大多数时候它只应用了一个“hover”类(我在firebug中看到),这显然与它们的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);
    
                    }
            }
        });
    
    
    
    
        });
    
    1 回复  |  直到 16 年前
        1
  •  0
  •   Shikiryu DhruvJoshi    15 年前

    你试着重新连接 .button 在 .upload_img 一旦你重新启用它?