Skip to content

Commit 6764d21

Browse files
authored
Update arx_slider.js
1 parent 81bace2 commit 6764d21

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

arx_slider.js

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,18 @@ const imgHolder = slider.querySelector(".imgholder")
1010
let currentSlider = 0;
1111
let dotsnum = sliderCount + 1;
1212
// CreateDots function creates clickable dots & caption based on the number of images and alt texts
13-
function CreateDots () {
14-
if ( dotsnum != 0 ) {
15-
const realId = sliderCount-(dotsnum-1)
16-
const newDot = document.createElement("div");
17-
const newCaption = document.createElement("div");
18-
newDot.classList.add("slider_dots");
19-
newDot.setAttribute("id", realId);
20-
newDot.setAttribute("onclick", ("sliderJump" + "(" + realId + ")") )
21-
newCaption.classList.add("slider_alts");
22-
newCaption.innerHTML = sliderImg[realId].alt;
23-
slider_dots_holder.appendChild(newDot);
24-
imgHolder.appendChild(newCaption);
25-
dotsnum--;
26-
CreateDots()
27-
}
13+
for ( ;dotsnum != 0;dotsnum--) {
14+
const realId = sliderCount-(dotsnum-1)
15+
const newDot = document.createElement("div");
16+
const newCaption = document.createElement("div");
17+
newDot.classList.add("slider_dots");
18+
newDot.setAttribute("id", realId);
19+
newDot.setAttribute("onclick", ("sliderJump" + "(" + realId + ")") )
20+
newCaption.classList.add("slider_alts");
21+
newCaption.innerHTML = sliderImg[realId].alt;
22+
slider_dots_holder.appendChild(newDot);
23+
imgHolder.appendChild(newCaption);
2824
}
29-
CreateDots()
3025
// Below codes are for Next and previous butttons
3126
const sliderdots = slider.querySelectorAll(".slider_dots")
3227
const slideralts = slider.querySelectorAll(".slider_alts")

0 commit comments

Comments
 (0)