Javascript Galleries & SlideShow JQuery Photo Slider with Semi Transparent Caption
User Rating: / 0
PoorBest 

Hi, in this tutorial i will show how to make a JQuery Photo Slider with Semi Transparent Caption!

JQuery Photo Slider with Semi Transparent Caption 

Demo          Download

 

Create a new html page, and in the head tag insert this code: 

<script type="text/javascript" src="js/jquery-1.3.1.min.js"></script>

<script type="text/javascript">

 

$(document).ready(function() {

 

//Execute the slideShow

slideShow();

 

});

 

function slideShow() {

 

//Set the opacity of all images to 0

$('#gallery a').css({opacity: 0.0});

 

//Get the first image and display it (set it to full opacity)

$('#gallery a:first').css({opacity: 1.0});

 

//Set the caption background to semi-transparent

$('#gallery .caption').css({opacity: 0.7});

 

//Resize the width of the caption according to the image width

$('#gallery .caption').css({width: $('#gallery a').find('img').css('width')});

 

//Get the caption of the first image from REL attribute and display it

$('#gallery .content').html($('#gallery a:first').find('img').attr('rel'))

.animate({opacity: 0.7}, 400);

 

//Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds

setInterval('gallery()',6000);

 

}

 

function gallery() {

 

//if no IMGs have the show class, grab the first image

var current = ($('#gallery a.show')?  $('#gallery a.show') : $('#gallery a:first'));

 

//Get next image, if it reached the end of the slideshow, rotate it back to the first image

var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#gallery a:first') :current.next()) : $('#gallery a:first'));

 

//Get next image caption

var caption = next.find('img').attr('rel');

 

//Set the fade in effect for the next image, show class has higher z-index

next.css({opacity: 0.0})

.addClass('show')

.animate({opacity: 1.0}, 1000);

 

//Hide the current image

current.animate({opacity: 0.0}, 1000)

.removeClass('show');

 

//Set the opacity to 0 and height to 1px

$('#gallery .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });

 

//Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect

$('#gallery .caption').animate({opacity: 0.7},100 ).animate({height: '100px'},500 );

 

//Display the content

$('#gallery .content').html(caption);

}

</script>

<link href="style.css" type="text/css" rel="stylesheet" /> 

 

In the body tag insert the code wich links images folder with html page: 

<div class="center">

 

<div id="gallery">

 

<a href="#" class="show">

<img src="images/flowing-rock.jpg" alt="Flowing Rock" width="580" height="360" title="" alt="" rel="<h3>Flowing Rock</h3>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "/>

</a>

 

<a href="#">

<img src="images/grass-blades.jpg" alt="Grass Blades" width="580" height="360" title="" alt="" rel="<h3>Grass Blades</h3>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. "/>

</a>

 

<a href="#">

<img src="images/ladybug.jpg" alt="Ladybug" width="580" height="360" title="" alt="" rel="<h3>Ladybug</h3>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."/>

</a>

 

<a href="#">

<img src="images/lightning.jpg" alt="Lightning" width="580" height="360" title="" alt="" rel="<h3>Lightning</h3>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."/>

</a>

 

<a href="#">

<img src="images/lotus.jpg" alt="Lotus" width="580" height="360" title="" alt="" rel="<h3>Lotus</h3>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo."/>

</a>

 

<a href="#">

<img src="images/mojave.jpg" alt="Mojave" width="580" height="360" title="" alt="" rel="<h3>Mojave</h3>Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt."/>

</a>

 

<a href="#">

<img src="images/pier.jpg" alt="Pier" width="580" height="360" title="" alt="" rel="<h3>Pier</h3>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."/>

</a>

 

<a href="#">

<img src="images/sea-mist.jpg" alt="Sea Mist" width="580" height="360" title="" alt="" rel="<h3>Sea Mist</h3>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."/>

</a>

 

<a href="#">

<img src="images/stones.jpg" alt="Stone" width="580" height="360" title="" alt="" rel="<h3>Stone</h3>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."/>

</a>

 

<div class="caption"><div class="content"></div></div>

</div><!--End Gallery-->

</div><!--End Center--> 

The last step is to download the jQuery plugin and links with html page! 

 

This script has been developed by http://www.queness.com!