2013-08-30 54 views
0

有沒有快速切換元素的方法?切換hide()快?

我有這樣的時刻:

$('.appearLate, .topMnu').toggle('hide'); 

但它在默認情況下逐漸變淡。 我需要它快速淡出,但無法確定如何應用該屬性。

有人能告訴我我該怎麼做?

+0

使用翻轉( '快'); – Rex

+0

爲什麼你傳遞''hide'作爲參數?文檔沒有提到它:http://api.jquery.com/toggle/。 –

回答

2

這將工作

$('.appearLate, .topMnu').toggle('fast'); 
$('.appearLate, .topMnu').toggle(100); //pass time in milliseconds 

$('.appearLate, .topMnu').fadeOut('fast'); 
$('.appearLate, .topMnu').fadeOut(100);//pass time in milliseconds 

http://api.jquery.com/fadeOut/

+0

頂尖 - 歡呼聲 – Dancer

+0

@Paul乾杯:) –

0

我認爲你正在尋找的fadeOut()功能:

$(selector).fadeOut('fast'); 
0
$('.appearLate, .topMnu').toggle(100); //100 being number of milisecconds to perform translation 
0

可以

$('.appearLate, .topMnu').slideToggle('fast'); 

$('.appearLate, .topMnu').fadeToggle('fast');