I've got this slideshow on one page and on my homepage I've got a list of images (the same ones as in the slide).
I want to be able to, by clicking on a specific picture on the homepage, come to the same picture of the slide on the slideshow-page.
I tried to ID everything, but the slide starts from the first picture however I do it.
Is there any way to make the slideIndex a specific number from the start by having something in the link?
<div class="nav" style="font-size: 15px; margin-top: 7px;">
<div class="">
<a class="" onclick="plusDivs(-1)"><div class="triangle-right"></div></a>
<a href="home.html"><div class="fyrkant"></div></a>
<a class="" onclick="plusDivs(1)"><div class="triangle-left"></div></a>
</div>
Slides
<div class="w3-display-container mySlides">
<img src="img/1.jpg" style="width:100%">
<div class="">
<h1>
1
</h1>
<p>
Description
</p>
</div>
<img src="img/1.1.jpg" style="width:100%">
</div>
<div class="w3-display-container mySlides">
<img src="img/2.jpg" style="width:100%; background-color: #fff;">
<div class="">
<h1>
2
</h1>
<p>
</p>
</div>
<img src="img/2.2.jpg" style="width:100%">
</div>
Script
<script>
var slideIndex = 1;
showDivs(slideIndex);
function plusDivs(n) {
showDivs(slideIndex += n);
}
function showDivs(n) {
var i;
var x = document.getElementsByClassName("mySlides");
if (n > x.length) {slideIndex = 1}
if (n < 1) {slideIndex = x.length}
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
x[slideIndex-1].style.display = "block";
}
</script>