i am quite new to JQuery. I am working on a slider which shows the image when the thumb is clicked. Now i have given some data-roles to the thumbs and the full image so that if thumb no.3 is clicked, the full image of data-id 3 is set to opacity 1 and z-index larger. Somehow, the slider works first time when the thumbs are clicked, but when i click on second time the image is not shown which has same i as thumb. here is my code
HTML
<div id="sliderContainer">
<!--Filters -->
<ul id="filterList">
<li>All</li>
<li>Objects</li>
<li>Fashion</li>
<li>Nature</li>
</ul>
<span id="titleText">asdsd</span>
<!--Thumbs List-->
<ul id="thumbsList">
<li class="thumbs" data-thumbid="1" data-title="Girl Eating Something"><img src="images/fashion/fashion1Thumb.jpg" /></li>
<li class="thumbs" data-thumbid="2" data-title="Beautiful Face"><img src="images/fashion/fashion2Thumb.jpg" /></li>
<li class="thumbs" data-thumbid="3" data-title="Cinderella"><img src="images/fashion/fashion3Thumb.jpg" /></li>
<li class="thumbs" data-thumbid="4" data-title="Apple Mobile"><img src="images/objects/object1Thumb.jpg" /></li>
<li class="thumbs" data-thumbid="5" data-title="Coke Can"><img src="images/objects/object2Thumb.jpg" /></li>
<li class="thumbs" data-thumbid="6" data-title="Mountains"><img src="images/nature/nature1thumb.jpg" /></li>
</ul>
<img class="productsSliderImage" data-fullimageid="1" src="images/fashion/fashion1Full.jpg" />
<img class="productsSliderImage" data-fullimageid="2" src="images/fashion/fashion2Full.jpg" />
<img class="productsSliderImage" data-fullimageid="3" src="images/fashion/fashion3Full.jpg" />
<img class="productsSliderImage" data-fullimageid="4" src="images/objects/object1Full.jpg" />
<img class="productsSliderImage" data-fullimageid="5" src="images/objects/object2Full.jpg" />
<img class="productsSliderImage" data-fullimageid="6" src="images/nature/nature1Full.jpg" />
<img class="productsSliderImage" data-fullimageid="7" src="images/nature/nature1Full.jpg" />
</div>
and here is my JQUERY
$(document).ready(function () {
$(".productsSliderImage").css('opacity', '0');
});
$(document).ready(function () {
$('.thumbs').click(function () {
var currentThumbId = $(this).attr("data-thumbid"); //grab thumbId of clicked thumb.
//Changing css of the fullscreenImage which is equal to clcked thumb.
//Animation is done using Opacity in css.
$('.productsSliderImage[data-fullImageId="' + currentThumbId + '"]').css('z-index', '33');
$('.productsSliderImage[data-fullImageId="' + currentThumbId + '"]').css('opacity', '1');
var notClicked = $('.productsSliderImage[data-fullImageId="' + currentThumbId + '"]').not(this);
notClicked.css('opacity', '1');
notClicked.css('z-index', '1');
});
});
And my Css
.productsSliderImage {
position: absolute;
z-index: 1;
-webkit-transition: all 0.8s ease;
-moz-transition: all 0.8s ease;
-ms-transition: all 0.8s ease;
-o-transition: all 0.8s ease;
transition: all 0.8s ease;
}