This is html that looks like can anyone help me out how to add the next and prev buttons to the larger image. Please help me out.
Js:
jQuery(function($) {
$('#thumbs').delegate('img','click', function(){
var src = this.src.replace('thumb', 'large');
$("#largeImage").fadeOut(function() {
this.src = src;
$(this).fadeIn();
});
});
});
Html:
<div id="page">
<div id="gallery">
<div id="panel">
<img id="largeImage" src="images/image_01_large.jpg" />
</div>
<div id="thumbs">
<img src="images/image_01_thumb.jpg" alt="1st image description" />
<img src="images/image_02_thumb.jpg" alt="2nd image description" />
<img src="images/image_03_thumb.jpg" alt="3rd image description" />
<img src="images/image_04_thumb.jpg" alt="4th image description" />
<img src="images/image_05_thumb.jpg" alt="5th image description" />
</div>
</div>
<a href="#" id="next">Next</a>
<br />
<a href="#" id="prev">Prev</a>
</div>
Without changing your code too much this should work. There are two things to note about how this work:
It relies on you keeping the id’s of the next and prev tags being named “next” and “prev”, these are used to call the corresponding jQuery functions that get the next and previous DOM elements.
$(function() {
});