Javascript image carousel

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
-1
down vote

favorite
1












I wrote the following code for creating a simple image carousel, that shows multiple images at the same time in the same order, but starting at a different position when the "next" or "prev" button is clicked.



This code works, but does it contradict programming principles and algorithms?



Is there a better solution?






var images = [
"1.jpg",
"2.jpg",
"3.jpg"
];
let slider = document.getElementById("slider");
function next()
images.forEach((item , index)=>
if(slider.getAttribute("src") == item)
if(index != images.length-1)
nextIndex = index+1;
else
nextIndex = 0;
);
slider.setAttribute("src",images[nextIndex]);

function prev()
images.forEach((item , index)=>
if(slider.getAttribute("src") == item)
if(index != 0)
prevIndex = index-1;
else
prevIndex = images.length-1;
);
slider.setAttribute("src",images[prevIndex]);

<div>
<button onClick = "prev()"> Prev </button>
<img id="slider" src="1.jpg"
width="200px" height="100px"/>
<button onClick = "next()"> Next </button>
</div>









share|improve this question

















  • 1




    The name "Slider" is not entirely correct for this, as it does not provide animation.
    – TimSparrow
    Feb 8 at 12:09










  • Consider preloading images, as a user will see them loading when they press buttons, which is not good, especially on slow connections
    – TimSparrow
    Feb 8 at 12:10
















up vote
-1
down vote

favorite
1












I wrote the following code for creating a simple image carousel, that shows multiple images at the same time in the same order, but starting at a different position when the "next" or "prev" button is clicked.



This code works, but does it contradict programming principles and algorithms?



Is there a better solution?






var images = [
"1.jpg",
"2.jpg",
"3.jpg"
];
let slider = document.getElementById("slider");
function next()
images.forEach((item , index)=>
if(slider.getAttribute("src") == item)
if(index != images.length-1)
nextIndex = index+1;
else
nextIndex = 0;
);
slider.setAttribute("src",images[nextIndex]);

function prev()
images.forEach((item , index)=>
if(slider.getAttribute("src") == item)
if(index != 0)
prevIndex = index-1;
else
prevIndex = images.length-1;
);
slider.setAttribute("src",images[prevIndex]);

<div>
<button onClick = "prev()"> Prev </button>
<img id="slider" src="1.jpg"
width="200px" height="100px"/>
<button onClick = "next()"> Next </button>
</div>









share|improve this question

















  • 1




    The name "Slider" is not entirely correct for this, as it does not provide animation.
    – TimSparrow
    Feb 8 at 12:09










  • Consider preloading images, as a user will see them loading when they press buttons, which is not good, especially on slow connections
    – TimSparrow
    Feb 8 at 12:10












up vote
-1
down vote

favorite
1









up vote
-1
down vote

favorite
1






1





I wrote the following code for creating a simple image carousel, that shows multiple images at the same time in the same order, but starting at a different position when the "next" or "prev" button is clicked.



This code works, but does it contradict programming principles and algorithms?



Is there a better solution?






var images = [
"1.jpg",
"2.jpg",
"3.jpg"
];
let slider = document.getElementById("slider");
function next()
images.forEach((item , index)=>
if(slider.getAttribute("src") == item)
if(index != images.length-1)
nextIndex = index+1;
else
nextIndex = 0;
);
slider.setAttribute("src",images[nextIndex]);

function prev()
images.forEach((item , index)=>
if(slider.getAttribute("src") == item)
if(index != 0)
prevIndex = index-1;
else
prevIndex = images.length-1;
);
slider.setAttribute("src",images[prevIndex]);

<div>
<button onClick = "prev()"> Prev </button>
<img id="slider" src="1.jpg"
width="200px" height="100px"/>
<button onClick = "next()"> Next </button>
</div>









share|improve this question













I wrote the following code for creating a simple image carousel, that shows multiple images at the same time in the same order, but starting at a different position when the "next" or "prev" button is clicked.



This code works, but does it contradict programming principles and algorithms?



Is there a better solution?






var images = [
"1.jpg",
"2.jpg",
"3.jpg"
];
let slider = document.getElementById("slider");
function next()
images.forEach((item , index)=>
if(slider.getAttribute("src") == item)
if(index != images.length-1)
nextIndex = index+1;
else
nextIndex = 0;
);
slider.setAttribute("src",images[nextIndex]);

function prev()
images.forEach((item , index)=>
if(slider.getAttribute("src") == item)
if(index != 0)
prevIndex = index-1;
else
prevIndex = images.length-1;
);
slider.setAttribute("src",images[prevIndex]);

<div>
<button onClick = "prev()"> Prev </button>
<img id="slider" src="1.jpg"
width="200px" height="100px"/>
<button onClick = "next()"> Next </button>
</div>








var images = [
"1.jpg",
"2.jpg",
"3.jpg"
];
let slider = document.getElementById("slider");
function next()
images.forEach((item , index)=>
if(slider.getAttribute("src") == item)
if(index != images.length-1)
nextIndex = index+1;
else
nextIndex = 0;
);
slider.setAttribute("src",images[nextIndex]);

function prev()
images.forEach((item , index)=>
if(slider.getAttribute("src") == item)
if(index != 0)
prevIndex = index-1;
else
prevIndex = images.length-1;
);
slider.setAttribute("src",images[prevIndex]);

<div>
<button onClick = "prev()"> Prev </button>
<img id="slider" src="1.jpg"
width="200px" height="100px"/>
<button onClick = "next()"> Next </button>
</div>





var images = [
"1.jpg",
"2.jpg",
"3.jpg"
];
let slider = document.getElementById("slider");
function next()
images.forEach((item , index)=>
if(slider.getAttribute("src") == item)
if(index != images.length-1)
nextIndex = index+1;
else
nextIndex = 0;
);
slider.setAttribute("src",images[nextIndex]);

function prev()
images.forEach((item , index)=>
if(slider.getAttribute("src") == item)
if(index != 0)
prevIndex = index-1;
else
prevIndex = images.length-1;
);
slider.setAttribute("src",images[prevIndex]);

<div>
<button onClick = "prev()"> Prev </button>
<img id="slider" src="1.jpg"
width="200px" height="100px"/>
<button onClick = "next()"> Next </button>
</div>








share|improve this question












share|improve this question




share|improve this question








edited Feb 8 at 21:16









Snowbody

7,7371343




7,7371343









asked Feb 8 at 11:29









mohsen hasani

133




133







  • 1




    The name "Slider" is not entirely correct for this, as it does not provide animation.
    – TimSparrow
    Feb 8 at 12:09










  • Consider preloading images, as a user will see them loading when they press buttons, which is not good, especially on slow connections
    – TimSparrow
    Feb 8 at 12:10












  • 1




    The name "Slider" is not entirely correct for this, as it does not provide animation.
    – TimSparrow
    Feb 8 at 12:09










  • Consider preloading images, as a user will see them loading when they press buttons, which is not good, especially on slow connections
    – TimSparrow
    Feb 8 at 12:10







1




1




The name "Slider" is not entirely correct for this, as it does not provide animation.
– TimSparrow
Feb 8 at 12:09




The name "Slider" is not entirely correct for this, as it does not provide animation.
– TimSparrow
Feb 8 at 12:09












Consider preloading images, as a user will see them loading when they press buttons, which is not good, especially on slow connections
– TimSparrow
Feb 8 at 12:10




Consider preloading images, as a user will see them loading when they press buttons, which is not good, especially on slow connections
– TimSparrow
Feb 8 at 12:10










1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










There are several problems with your code right now.



  1. Don't create global variables. nextIndex and prevIndex are both globals that are implicitly created when you first assign to them.



  2. Don't abuse not using braces on if statements. It is fine to skip them for a very simple statement (assuming it is allowed in your style guide) but nesting multiple ifs without braces is a recipe for disaster.



    // Much safer 
    if (slider.getAttribute("src") == item)
    if(index != images.length-1)
    nextIndex = index+1;
    else
    nextIndex = 0;



  3. Don't use setAttribute / getAttribute if you are accessing a standard property on an element. slider.src is shorter and easier to read than slider.getAttribute('src').


  4. Consider making your code more modular. What happens if you now want two sliders on the page? Ideally, it should just be another line of code to add the functionality (or maybe even no more lines of code!)


  5. Consider preloading images. TimSparrow mentioned this in the comments - with your current code the next image won't be loaded until the user clicks on the next button. This can result in a bad experience on slow connections.



There are a few more things I could say, but I believe it would be more helpful to just provide an alternative implementation.



This implementation has a couple advantages:



  1. You can just add another image-slider div wherever you want another set of images.

  2. By using an internal hidden div for storing the images, you automatically get preloaded images.




function createSlider(container) 
const images = container.querySelectorAll('.images > img');

const displayImage = container.querySelector('[data-display]')

// State
let imageIndex;

function setImage(index)
imageIndex = index;
displayImage.src = images[index].src;


// Show the first image initially
setImage(0);

// Button listener
container.addEventListener('click', event =>
if (event.target.hasAttribute('data-prev'))
setImage(imageIndex === 0 ? images.length - 1 : imageIndex - 1)
else if (event.target.hasAttribute('data-next'))
setImage(imageIndex === images.length - 1 ? 0 : imageIndex + 1)

);


document.querySelectorAll('.image-slider').forEach(createSlider);

.image-slider .images 
display: none;

<div class="image-slider">
<div class="images">
<img src="https://placeimg.com/200/100/animals">
<img src="https://placeimg.com/200/100/arch">
<img src="https://placeimg.com/200/100/nature">
</div>
<button data-prev>Prev</button>
<img data-display width="200px" height="100px">
<button data-next>Next</button>
</div>








share|improve this answer





















  • thanks , it's really very good . but i don't know source of container that placed as a argument in create slider function ; it's same document object? how? forgive me i am a beginner :(
    – mohsen hasani
    Feb 9 at 9:12











  • The container element is the div with the class image-slider in the html, take a look at what document.querySelectorAll('.image-slider') prints when you execute it in the dev console.
    – Gerrit0
    Feb 9 at 16:17










Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
);
);
, "mathjax-editing");

StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "196"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f187088%2fjavascript-image-carousel%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
2
down vote



accepted










There are several problems with your code right now.



  1. Don't create global variables. nextIndex and prevIndex are both globals that are implicitly created when you first assign to them.



  2. Don't abuse not using braces on if statements. It is fine to skip them for a very simple statement (assuming it is allowed in your style guide) but nesting multiple ifs without braces is a recipe for disaster.



    // Much safer 
    if (slider.getAttribute("src") == item)
    if(index != images.length-1)
    nextIndex = index+1;
    else
    nextIndex = 0;



  3. Don't use setAttribute / getAttribute if you are accessing a standard property on an element. slider.src is shorter and easier to read than slider.getAttribute('src').


  4. Consider making your code more modular. What happens if you now want two sliders on the page? Ideally, it should just be another line of code to add the functionality (or maybe even no more lines of code!)


  5. Consider preloading images. TimSparrow mentioned this in the comments - with your current code the next image won't be loaded until the user clicks on the next button. This can result in a bad experience on slow connections.



There are a few more things I could say, but I believe it would be more helpful to just provide an alternative implementation.



This implementation has a couple advantages:



  1. You can just add another image-slider div wherever you want another set of images.

  2. By using an internal hidden div for storing the images, you automatically get preloaded images.




function createSlider(container) 
const images = container.querySelectorAll('.images > img');

const displayImage = container.querySelector('[data-display]')

// State
let imageIndex;

function setImage(index)
imageIndex = index;
displayImage.src = images[index].src;


// Show the first image initially
setImage(0);

// Button listener
container.addEventListener('click', event =>
if (event.target.hasAttribute('data-prev'))
setImage(imageIndex === 0 ? images.length - 1 : imageIndex - 1)
else if (event.target.hasAttribute('data-next'))
setImage(imageIndex === images.length - 1 ? 0 : imageIndex + 1)

);


document.querySelectorAll('.image-slider').forEach(createSlider);

.image-slider .images 
display: none;

<div class="image-slider">
<div class="images">
<img src="https://placeimg.com/200/100/animals">
<img src="https://placeimg.com/200/100/arch">
<img src="https://placeimg.com/200/100/nature">
</div>
<button data-prev>Prev</button>
<img data-display width="200px" height="100px">
<button data-next>Next</button>
</div>








share|improve this answer





















  • thanks , it's really very good . but i don't know source of container that placed as a argument in create slider function ; it's same document object? how? forgive me i am a beginner :(
    – mohsen hasani
    Feb 9 at 9:12











  • The container element is the div with the class image-slider in the html, take a look at what document.querySelectorAll('.image-slider') prints when you execute it in the dev console.
    – Gerrit0
    Feb 9 at 16:17














up vote
2
down vote



accepted










There are several problems with your code right now.



  1. Don't create global variables. nextIndex and prevIndex are both globals that are implicitly created when you first assign to them.



  2. Don't abuse not using braces on if statements. It is fine to skip them for a very simple statement (assuming it is allowed in your style guide) but nesting multiple ifs without braces is a recipe for disaster.



    // Much safer 
    if (slider.getAttribute("src") == item)
    if(index != images.length-1)
    nextIndex = index+1;
    else
    nextIndex = 0;



  3. Don't use setAttribute / getAttribute if you are accessing a standard property on an element. slider.src is shorter and easier to read than slider.getAttribute('src').


  4. Consider making your code more modular. What happens if you now want two sliders on the page? Ideally, it should just be another line of code to add the functionality (or maybe even no more lines of code!)


  5. Consider preloading images. TimSparrow mentioned this in the comments - with your current code the next image won't be loaded until the user clicks on the next button. This can result in a bad experience on slow connections.



There are a few more things I could say, but I believe it would be more helpful to just provide an alternative implementation.



This implementation has a couple advantages:



  1. You can just add another image-slider div wherever you want another set of images.

  2. By using an internal hidden div for storing the images, you automatically get preloaded images.




function createSlider(container) 
const images = container.querySelectorAll('.images > img');

const displayImage = container.querySelector('[data-display]')

// State
let imageIndex;

function setImage(index)
imageIndex = index;
displayImage.src = images[index].src;


// Show the first image initially
setImage(0);

// Button listener
container.addEventListener('click', event =>
if (event.target.hasAttribute('data-prev'))
setImage(imageIndex === 0 ? images.length - 1 : imageIndex - 1)
else if (event.target.hasAttribute('data-next'))
setImage(imageIndex === images.length - 1 ? 0 : imageIndex + 1)

);


document.querySelectorAll('.image-slider').forEach(createSlider);

.image-slider .images 
display: none;

<div class="image-slider">
<div class="images">
<img src="https://placeimg.com/200/100/animals">
<img src="https://placeimg.com/200/100/arch">
<img src="https://placeimg.com/200/100/nature">
</div>
<button data-prev>Prev</button>
<img data-display width="200px" height="100px">
<button data-next>Next</button>
</div>








share|improve this answer





















  • thanks , it's really very good . but i don't know source of container that placed as a argument in create slider function ; it's same document object? how? forgive me i am a beginner :(
    – mohsen hasani
    Feb 9 at 9:12











  • The container element is the div with the class image-slider in the html, take a look at what document.querySelectorAll('.image-slider') prints when you execute it in the dev console.
    – Gerrit0
    Feb 9 at 16:17












up vote
2
down vote



accepted







up vote
2
down vote



accepted






There are several problems with your code right now.



  1. Don't create global variables. nextIndex and prevIndex are both globals that are implicitly created when you first assign to them.



  2. Don't abuse not using braces on if statements. It is fine to skip them for a very simple statement (assuming it is allowed in your style guide) but nesting multiple ifs without braces is a recipe for disaster.



    // Much safer 
    if (slider.getAttribute("src") == item)
    if(index != images.length-1)
    nextIndex = index+1;
    else
    nextIndex = 0;



  3. Don't use setAttribute / getAttribute if you are accessing a standard property on an element. slider.src is shorter and easier to read than slider.getAttribute('src').


  4. Consider making your code more modular. What happens if you now want two sliders on the page? Ideally, it should just be another line of code to add the functionality (or maybe even no more lines of code!)


  5. Consider preloading images. TimSparrow mentioned this in the comments - with your current code the next image won't be loaded until the user clicks on the next button. This can result in a bad experience on slow connections.



There are a few more things I could say, but I believe it would be more helpful to just provide an alternative implementation.



This implementation has a couple advantages:



  1. You can just add another image-slider div wherever you want another set of images.

  2. By using an internal hidden div for storing the images, you automatically get preloaded images.




function createSlider(container) 
const images = container.querySelectorAll('.images > img');

const displayImage = container.querySelector('[data-display]')

// State
let imageIndex;

function setImage(index)
imageIndex = index;
displayImage.src = images[index].src;


// Show the first image initially
setImage(0);

// Button listener
container.addEventListener('click', event =>
if (event.target.hasAttribute('data-prev'))
setImage(imageIndex === 0 ? images.length - 1 : imageIndex - 1)
else if (event.target.hasAttribute('data-next'))
setImage(imageIndex === images.length - 1 ? 0 : imageIndex + 1)

);


document.querySelectorAll('.image-slider').forEach(createSlider);

.image-slider .images 
display: none;

<div class="image-slider">
<div class="images">
<img src="https://placeimg.com/200/100/animals">
<img src="https://placeimg.com/200/100/arch">
<img src="https://placeimg.com/200/100/nature">
</div>
<button data-prev>Prev</button>
<img data-display width="200px" height="100px">
<button data-next>Next</button>
</div>








share|improve this answer













There are several problems with your code right now.



  1. Don't create global variables. nextIndex and prevIndex are both globals that are implicitly created when you first assign to them.



  2. Don't abuse not using braces on if statements. It is fine to skip them for a very simple statement (assuming it is allowed in your style guide) but nesting multiple ifs without braces is a recipe for disaster.



    // Much safer 
    if (slider.getAttribute("src") == item)
    if(index != images.length-1)
    nextIndex = index+1;
    else
    nextIndex = 0;



  3. Don't use setAttribute / getAttribute if you are accessing a standard property on an element. slider.src is shorter and easier to read than slider.getAttribute('src').


  4. Consider making your code more modular. What happens if you now want two sliders on the page? Ideally, it should just be another line of code to add the functionality (or maybe even no more lines of code!)


  5. Consider preloading images. TimSparrow mentioned this in the comments - with your current code the next image won't be loaded until the user clicks on the next button. This can result in a bad experience on slow connections.



There are a few more things I could say, but I believe it would be more helpful to just provide an alternative implementation.



This implementation has a couple advantages:



  1. You can just add another image-slider div wherever you want another set of images.

  2. By using an internal hidden div for storing the images, you automatically get preloaded images.




function createSlider(container) 
const images = container.querySelectorAll('.images > img');

const displayImage = container.querySelector('[data-display]')

// State
let imageIndex;

function setImage(index)
imageIndex = index;
displayImage.src = images[index].src;


// Show the first image initially
setImage(0);

// Button listener
container.addEventListener('click', event =>
if (event.target.hasAttribute('data-prev'))
setImage(imageIndex === 0 ? images.length - 1 : imageIndex - 1)
else if (event.target.hasAttribute('data-next'))
setImage(imageIndex === images.length - 1 ? 0 : imageIndex + 1)

);


document.querySelectorAll('.image-slider').forEach(createSlider);

.image-slider .images 
display: none;

<div class="image-slider">
<div class="images">
<img src="https://placeimg.com/200/100/animals">
<img src="https://placeimg.com/200/100/arch">
<img src="https://placeimg.com/200/100/nature">
</div>
<button data-prev>Prev</button>
<img data-display width="200px" height="100px">
<button data-next>Next</button>
</div>








function createSlider(container) 
const images = container.querySelectorAll('.images > img');

const displayImage = container.querySelector('[data-display]')

// State
let imageIndex;

function setImage(index)
imageIndex = index;
displayImage.src = images[index].src;


// Show the first image initially
setImage(0);

// Button listener
container.addEventListener('click', event =>
if (event.target.hasAttribute('data-prev'))
setImage(imageIndex === 0 ? images.length - 1 : imageIndex - 1)
else if (event.target.hasAttribute('data-next'))
setImage(imageIndex === images.length - 1 ? 0 : imageIndex + 1)

);


document.querySelectorAll('.image-slider').forEach(createSlider);

.image-slider .images 
display: none;

<div class="image-slider">
<div class="images">
<img src="https://placeimg.com/200/100/animals">
<img src="https://placeimg.com/200/100/arch">
<img src="https://placeimg.com/200/100/nature">
</div>
<button data-prev>Prev</button>
<img data-display width="200px" height="100px">
<button data-next>Next</button>
</div>





function createSlider(container) 
const images = container.querySelectorAll('.images > img');

const displayImage = container.querySelector('[data-display]')

// State
let imageIndex;

function setImage(index)
imageIndex = index;
displayImage.src = images[index].src;


// Show the first image initially
setImage(0);

// Button listener
container.addEventListener('click', event =>
if (event.target.hasAttribute('data-prev'))
setImage(imageIndex === 0 ? images.length - 1 : imageIndex - 1)
else if (event.target.hasAttribute('data-next'))
setImage(imageIndex === images.length - 1 ? 0 : imageIndex + 1)

);


document.querySelectorAll('.image-slider').forEach(createSlider);

.image-slider .images 
display: none;

<div class="image-slider">
<div class="images">
<img src="https://placeimg.com/200/100/animals">
<img src="https://placeimg.com/200/100/arch">
<img src="https://placeimg.com/200/100/nature">
</div>
<button data-prev>Prev</button>
<img data-display width="200px" height="100px">
<button data-next>Next</button>
</div>






share|improve this answer













share|improve this answer



share|improve this answer











answered Feb 8 at 20:58









Gerrit0

2,6701518




2,6701518











  • thanks , it's really very good . but i don't know source of container that placed as a argument in create slider function ; it's same document object? how? forgive me i am a beginner :(
    – mohsen hasani
    Feb 9 at 9:12











  • The container element is the div with the class image-slider in the html, take a look at what document.querySelectorAll('.image-slider') prints when you execute it in the dev console.
    – Gerrit0
    Feb 9 at 16:17
















  • thanks , it's really very good . but i don't know source of container that placed as a argument in create slider function ; it's same document object? how? forgive me i am a beginner :(
    – mohsen hasani
    Feb 9 at 9:12











  • The container element is the div with the class image-slider in the html, take a look at what document.querySelectorAll('.image-slider') prints when you execute it in the dev console.
    – Gerrit0
    Feb 9 at 16:17















thanks , it's really very good . but i don't know source of container that placed as a argument in create slider function ; it's same document object? how? forgive me i am a beginner :(
– mohsen hasani
Feb 9 at 9:12





thanks , it's really very good . but i don't know source of container that placed as a argument in create slider function ; it's same document object? how? forgive me i am a beginner :(
– mohsen hasani
Feb 9 at 9:12













The container element is the div with the class image-slider in the html, take a look at what document.querySelectorAll('.image-slider') prints when you execute it in the dev console.
– Gerrit0
Feb 9 at 16:17




The container element is the div with the class image-slider in the html, take a look at what document.querySelectorAll('.image-slider') prints when you execute it in the dev console.
– Gerrit0
Feb 9 at 16:17












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f187088%2fjavascript-image-carousel%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Chat program with C++ and SFML

Function to Return a JSON Like Objects Using VBA Collections and Arrays

Will my employers contract hold up in court?