2013-03-07 9 views
0

大家好,大家需要一些幫助爲我的網站。Mouseleave和模糊jQuery只是改變內容,如果兩者都爲真

我有一個輸入文本右側的按鈕有問題,我只想讓它自動對焦頁面加載,輸入焦點時,按鈕值改變時(比如寬度,顏色或內容)。 我希望當mouseleave或mouseout我div(#centro)和模糊(focusout)輸入文本,按鈕回到原來的,並且我有另一個問題,當按鈕恢復到原來的我需要一些動畫,因爲它只是瞬間現在恢復。

如果有人知道如何提高我的按鈕,我很感激!

+1

附加撥弄你試過嗎? – supersaiyan 2013-03-07 06:28:32

+0

看我的網站,http://www.kauan.com.br/piratame - Live Real Demo – Kauan 2013-03-07 06:30:57

回答

0

看到這個:

$(function() { 
    $("#inputselect").focus(function() { 
     $("#enviar").replaceWith("<button id='enviar'>" + "Avançado" + "</button>", 1000); 
     $("#enviar").animate({ 
      "width": "136px" 
     }, 1000); 
     $("#enviar").css({ 
      "background-color": "#EC0000" 
     }, 1000); 
    }); 
    $('#centro').mouseout(function() { 
     doAction(); 
    }); 
    $(document).mouseup(function (e) { 
     var container = $("#centro"); 
     if (container.has(e.target).length === 0) { 
      doAction(); 
     } 
    }); 

    function doAction() { 
     $("#enviar").replaceWith("<button id='enviar'>" + "OK" + "</button>", 1000); 
     $('#enviar').animate({ 
      width: '64px' 
     }, 1000); 
     $("#enviar").css({ 
      "background-color": "#990000" 
     }, 1000); 
    } 
}); 
+0

嗯,對不起我的英語,但我不想刪除鼠標移動區域時的輸入焦點,我希望按鈕恢復正常時我的鼠標離開區域,並刪除輸入焦點(當我點擊網站的其他部分),如點擊。所以我需要檢查兩個陳述,然後做功能。 – Kauan 2013-03-07 06:48:56

+0

我的意思是說。 – Kauan 2013-03-07 07:12:00

+0

嘗試更新的答案 – Anujith 2013-03-07 07:14:50