First I want to say that I am new in learning jQuery and I am trying to create a slideshow using it.
Here is the jQuery:
$(document).ready(function() {
$("#Slider li img").click(function() {
$("").fadeTo('slow',0);
$('#mainImg').attr('src',$(this).attr('src').replace('thumb/', ''));
});
var imgSwap = [];
$("#Slider li img").each(function() {
imgUrl = this.src.replace('thumb/', '');
imgSwap.push(imgUrl);
});
$(imgSwap).preload();
});
$.fn.preload = function() {
this.each( function() { $('<img/>')[0].src = this; });
}
And my divs:
<div id="Slider">
<img src="sliderImg/img_1.png" alt="" id="mainImg" />
<ul>
<li><img src="sliderImg/thumb/img_1.png" alt="" /></li>
<li><img src="sliderImg/thumb/img_2.png" alt="" /></li>
<li><img src="sliderImg/thumb/img_3.png" alt="" /></li>
<li><img src="sliderImg/thumb/img_4.png" alt="" /></li>
<li><img src="sliderImg/thumb/img_5.png" alt="" /></li>
<li><img src="sliderImg/thumb/img_6.png" alt="" /></li>
<li><img src="sliderImg/thumb/img_7.png" alt="" /></li>
<li><img src="sliderImg/thumb/img_8.png" alt="" /></li>
<li><img src="sliderImg/thumb/img_9.png" alt="" /></li>
</ul>
</div>
What I want to do is to make transitions between the images.
How can I do such a thing? I tried to use the fadeTo()
function but I could not succeed.
Thanks for help