first of all I'm a designer with little to no knowledge in jquery. I'm usually able to do research and find scripts that do what I want and then change them a bit. But this time I already did research for 4 days and still can't find anything that is close enough to what I'm looking for.
Currently I use this script:
$(function(){
$(".img-swap").live('click', function() {
if ($(this).attr("class") == "img-swap") {
this.src = this.src.replace("_1","_2");
} else {
this.src = this.src.replace("_2","_3");
}
$(this).toggleClass("on");
});
});
I have single images on the website. On click the image should be replaced like this:
I have folders with a max of 10 images. They are named 'projectxyz_01.jpg' etc. What I need now is a script that on click replaces 'project_xyz_01.jpg' with 'project_xyz_02.jpg' and so on. If there is no more picture in the folder go back to the first one. It would be nice if the images fade.
The script I currently use does only work to go from 1-3 of course, doesn't fade and doesn't go back to the first image.
This is the image container:
<div class="slideshow_querformat">
<img src="images/mmd/mmd_test_01.jpg" class="img-swap" border="0" alt="social media webcalender" title="Klicken, um die nächste Arbeit zu sehen." />
</div>
This is the css part:
.slideshow_querformat {
width:60.25%;
min-width:700px;
height:auto;
margin: 0 auto 0 auto;
text-align:center;
position:relative;
z-index:999;
}
.slideshow_querformat img {
max-width:100%;
max-height:100%;
cursor:pointer;
margin-left:16px;
}