There is a way to do this without needing to Javascript.
In this example below replace the images small by miniature and large by the big image.
To div
large images is adjusted to 500x375
pixels, so if using images of different sizes
should adjust the CSS of the images or change the size of the
div
.
HTML:
<div id="gallery">
<ul id="navigation">
<li><a href="#pic1"><img alt="" src="small_nature1.jpg" /></a></li>
<li><a href="#pic2"><img alt="" src="small_nature2.jpg" /></a></li>
<li><a href="#pic3"><img alt="" src="small_nature3.jpg" /></a></li>
<li><a href="#pic4"><img alt="" src="small_nature4.jpg" /></a></li>
<li><a href="#pic5"><img alt="" src="small_nature5.jpg" /></a></li>
</ul>
<div id="full-picture">
<div><a name="pic1"></a><img alt="" src="large_nature1.jpg" /></div>
<div><a name="pic2"></a><img alt="" src="large_nature2.jpg" /></div>
<div><a name="pic3"></a><img alt="" src="large_nature3.jpg" /></div>
<div><a name="pic4"></a><img alt="" src="large_nature4.jpg" /></div>
<div><a name="pic5"></a><img alt="" src="large_nature5.jpg" /></div>
</div>
</div>
CSS:
#gallery {
width: 600px;
overflow: hidden;
position: relative;
z-index: 1;
margin: 100px auto;
border: 2px solid #003C72;
}
#navigation {
list-style: none;
padding: 0;
margin: 0;
float: left;
}
#navigation li {
padding: 0;
margin: 0;
float: left;
clear: both;
}
#navigation li a img {
display: block;
border: none;
}
#navigation li a {
display: block;
}
#full-picture {
width: 500px;
height: 375px;
overflow: hidden;
float: left;
}
Source
Demonstration
Okay, what is your level of knowledge in HTML, Javascript and CSS? Can you describe what you have tried? You can [Edit] the question and add the HTML structure at least. If you have JS and CSS, search to make a [mcve] and you can use the snippet to execute it (button
</>
question editor). For more information, read the [Ask] guide and do the [tour] to understand how the community works.– Woss
My level of knowledge is basic, I am starting in this area I have not yet done anything in Java and css for this question, only the structure in html
– Erick Zanetti