Attenuation or output can be achieved by changing the opacity of an element over time, a very simple example:
var iframe = document.getElementById('iframe'); fadeOut(iframe, 1000); function fadeOut(el, duration) { var step = 10 / duration, opacity = 1; function next() { if (opacity <= 0) { return; } el.style.opacity = ( opacity -= step ); setTimeout(next, 10); } next(); }
Although jQuery is an incredible library, the use of which should be justified not only by its ability to create fantastic effects. The library should be accepted for its completeness and ease of use; not because it offers only one thing that you might want to use.
James source share