Fade to random seconds in jQuery

Description

The following code shows how to fade to random seconds.

Example


<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){<!--from  w w  w.ja  v a  2 s .  c o m-->
$("div").fadeTo("fast", Math.random());
});
</script>
</head>
<body>
<div>Click me</div>
</body>
</html>

Click to view the demo

The code above generates the following result.

Fade to random seconds in jQuery
Home »
  Javascript Tutorial »
    jQuery »
      jQuery Animation
...
Click to slide up animation in jQuery
Control speed and callback for fadeOut in j...
Disable all animations globally in jQuery
Fade an element away during animation in jQ...
Fade an element in animation in jQuery
Fade fast to random in jQuery
Fade in controlled by milliseconds in jQuer...
Fade out Paragraphs in jQuery
Fade out a button in 2 seconds in jQuery
Fade out a button in jQuery
Fade out and call a function with callback ...
Fade out button in jQuery
Fade out in milliseconds in jQuery
Fade out one second in jQuery
Fade out show a div element in jQuery
Fade out to in milliseconds in jQuery
Fade to a certain opacity in jQuery
Fade to and call a function in jQuery
Fade to random seconds in jQuery
Fast fade in jQuery
Fast fade in in jQuery
Fast fade out a button in jQuery
Fast fade out in jQuery
Fast fade to in jQuery
Fast slide toggle animation in jQuery
Header fade in and fade out in jQuery
Hide and Slide down animation in jQuery
Hide and remove animation in jQuery
Hide fast animation in jQuery
Hide in millisecond animation in jQuery
Move an element by changing left during ani...
Pass arguments.callee to show callback func...
Queue a custom function in jQuery
Replace the queue of all matched element wi...
Show a Div based Dialog in animation in jQu...
Show fast animation in jQuery
Show hidden div tags in animation in jQuery
Show hidden fast animation in jQuery
...