I need to pass the value of a function according to its clicked value. There are 3 divs, each one is a gallery. I need to click on the "see more" option, open a page with all the photos only from that gallery, however, I do not know how to pass the value of the gallery clicked, just assign the same direct in the code. Could you help? I load the function through body onload
on the targeted page, I do not know if it's the best way ...
The gallery:
while(x <= 3){
imgs.innerHTML += "<div id='gal"+x+"' class='row'>";
imgs.innerHTML += "<div class='eight columns'>";
imgs.innerHTML += "<h4>Galeria "+x+"</h4>"
for(var i = 0; i <= 3; i++){
galeria[i] = "foto"+x+"_"+(i+1)+".jpg";
}
for(var i = 0; i < galeria.length; i++){
imgs.innerHTML += "<img src='img/"+galeria[i]+"' class='imgs-galeria'>";
}
imgs.innerHTML += "</div>";
imgs.innerHTML += "</div>";
imgs.innerHTML += "<a href='teste.html'><div id='link'><p>Veja mais</p></div>";
x++;
}
The page teste.html
:
<body onload="maisGaleria(2);">
<div class="center">
<div class="row">
<div class="four columns top">
<h5>Nome</h5>
</div>
<div class="eight columns menu">
<ul>
<a href="index.html"><li><h4 class="menu-list">Home</h4></li></a>
<a href="galeria.html"><li><h4 class="menu-list">Galeria</h4></li></a>
<a href="sobre.html"><li><h4 class="menu-list">Sobre</h4></li></a>
<a href="contato.html"><li><h4 class="menu-list">Contato</h4></li></a>
</ul>
</div>
</div>
<div class="row galeria">
<div id="gallery" class="container">
</div>
</div>
<div class="row">
<div id="footer">
<div class="four columns">
<h4>Nome</h4>
</div>
<div class="eight columns img-footer" id="social">
</div>
</div>
</div>
</div>
and the function maisGaleria(n)
:
function maisGaleria(n){
var galeria = new Array();
var img = $("#gallery");
img.innerHTML = "<div class='row'>";
img.innerHTML = "<div class='six columns'>";
//imgs.innerHTML += "<h4>Galeria"+n+"</h4>";
for(var i = 0; i <= 3; i++){
galeria[i] = "foto"+n+"_"+(i+1)+".jpg";
}
//se utilizar <=galeria.length, ele adicionara um valor vazio, que foi atribuido devido ao (i+1) do outro for.
for(var i = 0; i < galeria.length; i++){
img.innerHTML += "<img src='img/"+galeria[i]+"' class='imgs-galeria'>";
}
img.innerHTML += "</div>";
img.innerHTML += "</div>";
}