I have been attempting to create transitions between images using links. I followed the steps in 'Demo 6' from this page (http://css3.bradshawenterprises.com/cfimg/), but unfortunately, it did not work as expected on my testing website (danithemes.fanscity.eu/shugar). I have double-checked the code provided on the tutorial page, and it seems to be the same.
Below is the CSS code I am using:
p#cf7_controls {
text-align:center;
}
#cf7_controls span {
padding-right:2em;
cursor:pointer;
}
#cf7 {
position:relative;
height:281px;
width:450px;
margin:0 auto 10px;
}
#cf7 img {
position:absolute;
left:0;
-webkit-transition: opacity 1s ease-in-out;
-moz-transition: opacity 1s ease-in-out;
-o-transition: opacity 1s ease-in-out;
transition: opacity 1s ease-in-out;
opacity:0;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
}
#cf7 img.opaque {
opacity:1;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=1);
}
Here is the HTML code:
<div id="cf7" class="shadow">
<img class='opaque' src="http://css3.bradshawenterprises.com/images/Birdman.jpg" />
<img src="http://css3.bradshawenterprises.com/images/Birdman.jpg;" />
<img src="http://css3.bradshawenterprises.com/images/Birdman.jpg;" />
<img src="http://css3.bradshawenterprises.com/images/Birdman.jpg;" />
</div>
<p id="cf7_controls">
<span class="selected">Image 1</span>
<span>Image 2</span>
<span>Image 3</span>
<span>Image 4</span>
</p>
And the JavaScript code:
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$("#cf7_controls").on('click', 'span', function() {
$("#cf7 img").removeClass("opaque");
var newImage = $(this).index();
$("#cf7 img").eq(newImage).addClass("opaque");
$("#cf7_controls span").removeClass("selected");
$(this).addClass("selected");
});
});
</script>
My question is: Despite following the tutorial, what mistake am I making? Any insights would be greatly appreciated!