Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery's fadein 'slow' is too fast

Tags:

i'm using the jquery fadein fadeout with the slow option, but it's still a little too fast for me. now i've read that you can only choose between fast and slow, but is there a way to make it slower?

like image 223
Michel Avatar asked Nov 03 '10 11:11

Michel


1 Answers

You have two options. The first is to use a number of milliseconds in the call:

$('#myItem').fadeOut(1500); // 1.5 seconds 

The second option is to define a custom speed, or to redefine a jQuery native speed:

$.fx.speeds.slow = 1500; // 'slow' now means 1.5 seconds $.fx.speeds.xslow = 3000; // 'xslow' means 3 seconds $.fx.speeds.xfast = 100; // 'xfast' means 0.1 seconds 

You can then call them as normal:

$('#myItem').fadeOut('slow'); $('#myItem').fadeOut('xslow'); $('#myItem').fadeOut('xfast'); 

This allows you to redefine speeds on an application-wide basis.

like image 134
lonesomeday Avatar answered Oct 12 '22 00:10

lonesomeday