<div class="slider">
<div class="slides">
<input type="radio" name="radio-button" id="radio1">
<input type="radio" name="radio-button" id="radio2">
<input type="radio" name="radio-button" id="radio3">
<input type="radio" name="radio-button" id="radio4">
<input type="radio" name="radio-button" id="radio5">
<input type="radio" name="radio-button" id="radio6">
<div>
<div id="next"><</div>
<div id="previous">></div>
<div class="navigation-manual">
<label for="radio1" class="manual-button"></label>
<label for="radio2" class="manual-button"></label>
<label for="radio3" class="manual-button"></label>
<label for="radio4" class="manual-button"></label>
<label for="radio5" class="manual-button"></label>
<label for="radio6" class="manual-button"></label>
</div>
</div
var counter = 1;
setInterval(function()
{document.getElementById('radio' + counter).checked = true;
counter++;
if(counter > 6){
counter = 1;
}
}, 5000);
I want to add the button next/previous function to my slider but I’m confused about writing the code, does anyone want to help?
>Solution :
Please refer to below javascript link and it will work for you 100%.