Jump to content
yugiorima123

help me carousel slideshow

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

Share this post


Link to post
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😢

Share this post


Link to post
Share on other sites

 

</pre>
<table>				 										var child = myImgs.children;									 										//alert(child.src);									 										 									 										
					myImgs.insertBefore(child[0],child[child.length-1]);								
					myImgs.removeChild(child.length-1);													 										}					</table>
<p>	 </p><p

  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...