2014-01-06 87 views
-1

我有一個非常粗糙的PHP聯繫表單我希望按下發送動畫效果。我希望我的表格能夠從屏幕上拍攝下來,接着是一個小動畫,最後是表格回落,非常好。我唯一的問題是,在迴歸中清除表格,現在有人能做到這一點嗎?任何幫助將大規模讚賞。以下是有關聯繫表格的鏈接。單擊發送時返回清除表單

http://locodesignz.com

的問題,現在解決了!多謝你們。

+1

你已經將這個問題標記爲Java問題。它與Java有什麼關係? –

+0

我們會幫忙,但你應該發佈你的代碼 – Zword

+0

我做道歉,按發送後,我正在使用JS一個小動畫。 –

回答

0

這應該工作:

首先:只有保持連接到button.Remove的onclick = 「」 點擊事件:

<input class="button" type="button" value="Send It" name="submit"></input> 

:添加提交和重置了jQuery :

$(document).ready(function(){ 
    $(".button").click(function(){ 

     $("#contact-form") .delay(1000) .animate({ height:'toggle', opacity:'toggle' }, (400)); 

     $("#sending-wrapper") .delay(1400) .animate({ top: '-=593' }, 400); 
     $("#sending-wrapper") .delay(2400) .animate({ top: '+=593' }, 400); 

     $("#thanks") .delay(4700) .animate({ top: '-=593' }, 400); 
     $("#thanks") .delay(2400) .animate({ top: '+=593' }, 400); 

     $("#contact-form") .delay(6600) .animate({ height:'toggle', opacity:'toggle' }, (400)); 

     // to reset the form data 
     document.getElementById("contact").submit(); 
     document.getElementById("contact").reset(); 
    }); 
}); 
+0

工作就像一個魅力!非常感謝您的幫助@zword並感謝所有其他人! –

+0

歡迎@LiamDavidHodnett – Zword

+0

@LiamDavidHodnett這將不會完美工作,因爲在提交它之前,它的數據被重置。所以你不能點擊「發送」按鈕獲取數據。 –

0

在wesite上看到你的代碼後,這是我的答案。如果您只想重置數據,請使用:

document.getElementById("contact").reset(); 

單擊「發送它」按鈕時寫下此代碼。 夠簡單。

編輯:

我已經看到有這一段代碼寫在網頁上。修改爲:

$(document).ready(function(){ 
    $(".button").click(function(){ 

     $("#contact-form") .delay(1000) .animate({ height:'toggle', opacity:'toggle' }, (400)); 

     $("#sending-wrapper") .delay(1400) .animate({ top: '-=593' }, 400); 
     $("#sending-wrapper") .delay(2400) .animate({ top: '+=593' }, 400); 

     $("#thanks") .delay(4700) .animate({ top: '-=593' }, 400); 
     $("#thanks") .delay(2400) .animate({ top: '+=593' }, 400); 

     $("#contact-form") .delay(6600) .animate({ height:'toggle', opacity:'toggle' }, (400)); 

     // to reset the form data 
     document.getElementById("contact").reset(); 
    }); 
}); 

我希望這會幫助你。

+0

對不起@khurramhassan我有點新PHP和JS,這段代碼到底在哪裏?謝謝,真的很感激它。 –

+0

好吧,我會告訴你 –

0
$(document).ready(function(){ 
$(".button").click(function(){ 

$("#contact-form") .delay(1000) .animate({ height:'toggle', opacity:'toggle' }, (400)); 

$("#sending-wrapper") .delay(1400) .animate({ top: '-=593' }, 400); 
$("#sending-wrapper") .delay(2400) .animate({ top: '+=593' }, 400); 

$("#thanks") .delay(4700) .animate({ top: '-=593' }, 400); 
$("#thanks") .delay(2400) .animate({ top: '+=593' }, 400); 

$("#contact-form") .delay(6600) .animate({ height:'toggle', opacity:'toggle' }, (400)); 
$("#contact")[0].reset(); 

}); 
}); 

你可以用你替換你的代碼我已經添加了Jquery form reset給你點擊功能

+0

謝謝@Anthony然而,我擔心表單輸入變量仍然存在,我很欣賞這個幫助! –

+0

對不起,我已經對重置代碼進行了編輯,請再試一次 – Anthony