1
I have a photo slideshow that when you click on the photo it opens the bigger photos.
In the gallery of larger photos, I just need to pass the value start:nºda foto
, for it to start from the clicked photo. photo number is the id that is passed by the function galeria(this.id)
.
Then I made a str.replace to sub-stage the start:0
(which is how it starts), for the start:id
, which is the past value, the problem that only works once, after it changes the start:0
to the start:id
, I don’t know how to make him find the last start:id
to the new start:id
<ul id="galeriamenor">
<li><a href="#galeria" id="1" onclick="galeria(this.id)"><img src="foto1"></a></li>
<li><a href="#galeria" id="2" onclick="galeria(this.id)"><img src="foto2"></a></li>
<li><a href="#galeria" id="3" onclick="galeria(this.id)"><img src="foto3"></a></li>
<li><a href="#galeria" id="4" onclick="galeria(this.id)"><img src="foto4"></a></li>
</ul>
<ul id="galeria" data-uk-slideshow="{start:0}">
<li><img src="maior/foto1"></li>
<li><img src="maior/foto2"></li>
<li><img src="maior/foto3"></li>
<li><img src="maior/foto4"></li>
</ul>
<script>
function galeria(id) {
var str = document.getElementById("galeria").innerHTML;
var res = str.replace("start:0", "start:"+id);
document.getElementById("galeria").innerHTML = res;
}
</script>