Jump to content

help me carousel slideshow


yugiorima123

Recommended Posts

How can we create carousel image slider using Javascript ?

 carousel-acf-slider.pngi

Im used 

<script >
  var vLeftButton = document.getElementById("iconL");
  //var t = setInterval(leftAction,1000);
  function leftAction(){
  var myImgs = document.getElementById("divImg");
  var child = myImgs.children[0];
  //alert(child.src);
  myImgs.removeChild(child);
  myImgs.appendChild(child);
  }
   
  var vRightButton = document.getElementById("iconR");
  function rightAction(){
  var myImgs = document.getElementById("divImg");
  var child = myImgs.children[0];
  //alert(child.src);
  myImgs.removeChild(child);
  myImgs.appendChild(child);
  }
 

</script>

I mean:

leftbutton move to left

but right button don't move to right

I'm amateur😢

Edited by yugiorima123
Link to comment
Share on other sites

3 minutes ago, dsonesuk said:

vLeftButton, IconL, leftAction(), hmmm wonder why it does not work for right? A real puzzler this one.

<script >
  var vLeftButton = document.getElementById("iconL");
  //var t = setInterval(leftAction,1000);
  function leftAction(){
  var myImgs = document.getElementById("divImg");
  var child = myImgs.children[0];
  //alert(child.src);
  myImgs.removeChild(child);
  myImgs.appendChild(child);
  }
   
  var vRightButton = document.getElementById("iconR");
  function rightAction(){
  var myImgs = document.getElementById("divImg");
  var child = myImgs.children[0];
  //alert(child.src);
  myImgs.removeChild(child);
  myImgs.appendChild(child);
  }
 

</script>

mean:

but right button don't move to right

I'm amateur😢

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...