Slider from Dynamic Elements using JSON data
- Create a function that gets invoked once the DOM content loads. Give the function a name of adder()
- Within adder() create the slides, using the data from the JSON file apply the text title, html content, and styling to the slide elements. Add them to the page.
- If it’s the first item in the data then add the class of active to the first one only
- Add an event listener to the buttons, when clicked check if it contains the next class, create a function named mover() to handle the result
- Get the current element with the active class. Using traversing, get the next sibling to the current element, if no next element exists then select the first child of the parent slider element.
- Get the previous element, if it’s null then select the last child of the parent slider.
- Remove the active class for the current element, add the active class to the new element either previous or next.