i have build a small function whose work is to change banner image path when the user clicks on “a” tag. it works fine but when i click on “a” tag it changes image. but it is taking a bit of time because size of the image is heavy. so i want to put ajax loader till the time the image loads itself.
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(function(){
$('.control').find('a').click(function(){
var path= $(this).text();
$('#banner').find('img').attr('src','images/' + path +'.jpg' )
})
})
</script>
</head>
<body>
<div id="banner">
<img width="500" height="300" src="images/first.jpg" />
</div>
<div class="control">
<a href="#" id="first">first</a>
<a href="#" id="second">second</a>
<a href="#" id="third">third</a>
<a href="#" id="forrth" >fourth</a>
</div>
</body>
You can try this one
jQuery Loadmask