# Slider with "Random" button.

**URL:** https://forum.kirupa.com/t/slider-with-random-button/635457
**Category:** programming
**Created:** [October 22, 2016, 7:27pm UTC](https://forum.kirupa.com/t/slider-with-random-button/635457 "2016-10-22T19:27:41Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![DesignsCross](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/designscross/32/7811_2.png) [@DesignsCross](https://forum.kirupa.com/u/DesignsCross)
#### Post date: [October 22, 2016, 7:27pm UTC](https://forum.kirupa.com/t/slider-with-random-button/635457/1 "2016-10-22T19:27:42Z")

</div>

I wanna Create sth like this, but im relativly new to javascript

the main features shout be:

1. the Slider should start at a random position (image)
2. when you “click” the “Random” button, the slider moves x(maybe 20images)
3. there not be everytime “20images”, so it need to be a infinte slide.
4. 3 images shown, and the image that was picked by the “randombutton” must be in the middle

i hope you understand, what i mean 🙂, if there are any questions, dont wait and ask.

 ![](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/2X/f/f1a29f288e8e59b920778faf7d4a27fc0085b371.png)

if anyone could help me, that helped me so much!! \<3

---

<div class="post-metadata">

### Author: ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)
#### Post date: [October 22, 2016, 7:46pm UTC](https://forum.kirupa.com/t/slider-with-random-button/635457/2 "2016-10-22T19:46:18Z")

</div>

Have you read this article: [https://www.kirupa.com/html5/creating\_a\_sweet\_content\_slider.htm](https://www.kirupa.com/html5/creating_a_sweet_content_slider.htm)

It doesn’t solve all of your conditions, but it sets you up for figuring out the rest. We can help with the missing pieces 🙂

---

<div class="post-metadata">

### Author: ![DesignsCross](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/designscross/32/7811_2.png) [@DesignsCross](https://forum.kirupa.com/u/DesignsCross)
#### Post date: [October 22, 2016, 8:03pm UTC](https://forum.kirupa.com/t/slider-with-random-button/635457/3 "2016-10-22T20:03:17Z")

</div>

i´ve read it, and reproduced it, but i dont know, how to make it “random”  
-random placing  
-random start

- with “click” get to to a position “20 images” away

🙂

---

<div class="post-metadata">

### Author: ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)
#### Post date: [October 23, 2016, 6:06pm UTC](https://forum.kirupa.com/t/slider-with-random-button/635457/4 "2016-10-23T18:06:18Z")

</div>

That is a good one! Let me fiddle with this for a bit and see what happens. It will definitely involve fiddling with the `activeLink` value which the slider relies on to know where it is currently and where to go next! 😛

The infinite slide thing will be more of a challenge, for we’ll need to populate and remove elements from the DOM frequently.

---

<div class="post-metadata">

### Author: ![DesignsCross](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/designscross/32/7811_2.png) [@DesignsCross](https://forum.kirupa.com/u/DesignsCross)
#### Post date: [October 25, 2016, 12:51pm UTC](https://forum.kirupa.com/t/slider-with-random-button/635457/5 "2016-10-25T12:51:33Z")

</div>

alfter click the button and after the slide stops, it should return and make again a random start ect 🙂

---

<div class="post-metadata">

### Author: ![DesignsCross](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/designscross/32/7811_2.png) [@DesignsCross](https://forum.kirupa.com/u/DesignsCross)
#### Post date: [October 25, 2016, 2:15pm UTC](https://forum.kirupa.com/t/slider-with-random-button/635457/6 "2016-10-25T14:15:15Z")

</div>

i found a infinite slider here: [http://web.enavu.com/tutorials/making-a-jquery-infinite-carousel-with-nice-features/](http://web.enavu.com/tutorials/making-a-jquery-infinite-carousel-with-nice-features/)

---

<div class="post-metadata">

### Author: ![DesignsCross](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/designscross/32/7811_2.png) [@DesignsCross](https://forum.kirupa.com/u/DesignsCross)
#### Post date: [October 25, 2016, 3:48pm UTC](https://forum.kirupa.com/t/slider-with-random-button/635457/8 "2016-10-25T15:48:58Z")

</div>

[https://gist.github.com/DesignsCross/8b9256af55ff6228addcf5d456bd0b44](https://gist.github.com/DesignsCross/8b9256af55ff6228addcf5d456bd0b44) -

---

<div class="post-metadata">

### Author: ![DesignsCross](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/designscross/32/7811_2.png) [@DesignsCross](https://forum.kirupa.com/u/DesignsCross)
#### Post date: [October 30, 2016, 3:38pm UTC](https://forum.kirupa.com/t/slider-with-random-button/635457/9 "2016-10-30T15:38:41Z")

</div>

someone know, how i start randomly, and when i press “next” it goes ,maybe 50images away ? 🙂

---

<div class="post-metadata">

### Author: ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)
#### Post date: [October 30, 2016, 5:24pm UTC](https://forum.kirupa.com/t/slider-with-random-button/635457/10 "2016-10-30T17:24:11Z")

</div>

This article just came out a few days ago. Seems timely 😛 [http://mediatemple.net/blog/tips/carousels-dont-have-to-be-complicated/](http://mediatemple.net/blog/tips/carousels-dont-have-to-be-complicated/)

There is one with an infinite scroller there as well.

🍪

---

<div class="post-metadata">

### Author: ![DesignsCross](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/designscross/32/7811_2.png) [@DesignsCross](https://forum.kirupa.com/u/DesignsCross)
#### Post date: [October 31, 2016, 7:26pm UTC](https://forum.kirupa.com/t/slider-with-random-button/635457/11 "2016-10-31T19:26:47Z")

</div>

i already have a infinte slider, but thx, but i still dont know how to start randomly, and when i press “next” it goes, maybe 50 images away 🙂 (gist link=my code of infinite slider)
