0
I have a simple gallery where each image leads to a new page with your description. It turns out that the page layout for the descriptions is the same, only changing the content. How to make only some fields on this page be changed according to the previously clicked items on the gallery page?
<html>
<head>
<title>Galeria</title>
<link rel ="stylesheet" href= "css/galeria.css">
</head>
<body>
<div class="gallery">
<a target="_self" href="desc1.html">
<img src="img/imagem1.jpg" alt="Imagem 1" width="200" height="200">
</a>
<div class="desc">Imagem 1</div>
</div>
<div class="gallery">
<a target="_self" href="desc2.html">
<img src="img/imagem2.jpg" alt="Imagem 2" width="200" height="200">
</a>
<div class="desc">Imagem 2</div>
</div>
<div class="gallery">
<a target="_self" href="desc3.html">
<img src="img/imagem3.jpg" alt="Imagem 3" width="200" height="200">
</a>
<div class="desc">Imagem 3</div>
</div>
<div class="gallery">
<a target="_self" href="desc4.html">
<img src="img/imagem4.jpg" alt="Imagem 4" width="200" height="200">
</a>
<div class="desc">Imagem 4</div>
</div>
</body>
</html>
I recommend you use a framework for this, will help you a lot. Has Angular 1.x, Knockout.. among others easier to learn. You can do what you want using jQuery, but it’s a little more work.
– Douglas Garrido
Welcome to the SOPT. It would have as [Edit] your post and add the code you are using to make your gallery, so we can analyze and suggest a change. Thank you.
– David
I added the code. I am still very beginner in this subject, the gallery is very simple. The problem is having to do desc1.html, desc2.html, desc 3.html... for each description. For larger galleries, I would like to know how to use the same html and load the information corresponding to what was clicked there.
– Pedro Vincente
I gave this answer in this How to open a specific div on another page?
– Leon Freire