<!DOCTYPE html PUBLIC "- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>jQuery Gradient Fade Demo</title>
<script type="text/javascript" src="jquery-latest.pack.js"></script>
<script type="text/javascript">
$(
function(){
$( "img.gradient" ).each(
function( intIndex ){
var jImg = $( this );
var jParent = null;
var jDiv = null;
var intStep = 0;
jParent = jImg.parent();
jParent
.css( "position", "relative" )
.width( jImg.width() )
.height( jImg.height() )
;
for (
intStep = 0 ;
intStep <= 20 ;
intStep++
){
jDiv = $( "<div></div>" );
jDiv
.css (
{
backgroundColor: "#FFFFFF",
opacity: (intStep * 5 / 100),
bottom: ((100 - (intStep * 5) ) + "px"),
left: "0px",
position: "absolute"
}
)
.width( jImg.width() )
.height( 5 )
;
jParent.append( jDiv );
}
}
);
}
);
</script>
</head>
<body>
<h1>
jQuery Gradient Fade Demo
</h1>
<p>
Here is the image before we add the gradient:
</p>
<p>
<img
src="jumping_girl.jpg"
width="545"
height="386"
alt="Girl jumping in bikini"
/>
</p>
<p>
Here is the image after we add the gradient:
</p>
<p>
<img
src="jumping_girl.jpg"
width="545"
height="386"
alt="Girl jumping in bikini"
class="gradient"
/>
</p>
</body>
</html>