- 30 Splendid Examples of Motion Blur Photography | Modny73 http://bit.ly/chd4JT... 24 hours ago
- 15 Creative and Well-Designed Brochures http://bit.ly/cVRLHO... 2 days ago
- Follow me
If you have been reading my website from the start you would have read this tutorial:
Simple jQuery Image Slide Show with Semi Transparent CaptionIt's a very famous post because it has been showcased in several major web design blogs so many times and I received a lot of traffic from it. Thanks guys. I get a lot of comment and as I replied to those comments and do some quick fixes, I realized that this script has a caption bug and inefficient and not up to standard (oh well, that's the time when I was start picking up jQuery :)), so I have decided to do revisit to solve all those problems discovered by readers. I rewrote the html structure and modify the script.
Mission Objectives:
However, one thing though, it needs javascript, if your browser is javascript disabled, sorry, there is no graceful degradation for this script, it will just display the first item.
Yes, I'm using list this time :) This is how it should have been afterall. No more REL attribute, we wil be using TITLE Attribute to store the heading and ALT attribute to store the description. For the caption elements, it will be added using jQuery. So, this is it - a clean and simple HTML code.
<ul class="slideshow"> <li class="show"><a href="#"><img src="images/s1.gif" width="450" height="200" title="Slide 1" alt="Short Description"/></a></li> <li><a href="#"><img src="images/s2.gif" width="450" height="200" title="Slide 2" alt="Short Description"/></a></li> <li><a href="#"><img src="images/s3.gif" width="450" height="200" title="Slide 3" alt="Short Description"/></a></li> </ul>
CSS code is rewritten completely. I guarantee it's cross browser compliant. They all look identical and it works great :) I did learn a lot of CSS technique through this blog. We all can improve our skills through tips, tricks, trials and errors. Read these posts to learn more about CSS:
body {
font-family:arial;
font-size:12px;
}
ul.slideshow {
list-style:none;
width:450px;
height:200px;
overflow:hidden;
position:relative;
margin:0;
padding:0;
}
ul.slideshow li {
position:absolute;
left:0;
right:0;
}
ul.slideshow li.show {
z-index:500;
}
ul img {
border:none;
}
#slideshow-caption {
width:450px;
height:70px;
position:absolute;
bottom:0;
left:0;
color:#fff;
background:#000;
z-index:500;
}
#slideshow-caption .slideshow-caption-container {
padding:5px 10px;
z-index:1000;
}
#slideshow-caption h3 {
margin:0;
padding:0;
font-size:14px;
}
#slideshow-caption p {
margin:5px 0 0 0;
padding:0;
}
We will going to use call back function to display caption. This will solve the "Caption Is Appearing Before The Next Slide Syndrome" :). Not too much of changes in javascript but I do added a feature though. On mouse over the slide will pause, and resume it back on mouse out. I think it's a good touch.
$(document).ready(function() {
//Execute the slideShow, set 4 seconds for each images
slideShow(2000);
});
function slideShow(speed) {
//append a LI item to the UL list for displaying caption
$('ul.slideshow').append('Updated the article and scripts, the link issue is fixed. :) Sorry for the delay.
I have made a lot of tutorials, and I think it's good to do a revisit to make it more efficient and solve some of the annoying bugs instead of quick fixes. So, yea, from now on, I will check my previous tutorials and rewrite them. :)
Like this tutorials? You can express your gratitude by visiting my sponsors on the sidebar, bookmark it and help me to spread this tutorial to our friends! :) Thanks!
The effects and techniques demonstrated in tutorials on Queness can be used in whatever manner you wish without attribution. You cannot copy whole tutorials (unless permission is given), either in English or translated to another language.
Buy wholesale computers directly from China at DHgate.com
Discover the tools to build your e-Commerce Site with Netfirms
Buy China Products from Made-in-China.com
Cocktail Dresses
SmartPhone Cell Phone
Wholesale electronics
VPS Hosting - cPanel virtual servers from Host Color
Web Hosting Rating
Buy WOW Gold
Recent Comments