# How to click between slides by clicking my own button  

**URL:** <https://forum.wixstudio.com/t/how-to-click-between-slides-by-clicking-my-own-button/14973>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [December 9, 2017, 7:55am UTC](https://forum.wixstudio.com/t/how-to-click-between-slides-by-clicking-my-own-button/14973 "2017-12-09T07:55:45Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![croberts](https://avatars.discourse-cdn.com/v4/letter/c/ccd318/32.png) [@croberts](https://forum.wixstudio.com/u/croberts)\
**Post date:** [December 9, 2017, 7:55am UTC](https://forum.wixstudio.com/t/how-to-click-between-slides-by-clicking-my-own-button/14973/1 "2017-12-09T07:55:45Z")

</div>

I am trying to figure out how (through wix code) that when I have the slide buttons disabled how can I add my own button that links to a specific slide. (i.e. When I click my button on slide 3, it links to slide 5?  
Your help would be appreciated

---

<div class="post-metadata">

**Author:** ![yoav-wix](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/yoav-wix/32/674_2.png) [@yoav-wix](https://forum.wixstudio.com/u/yoav-wix)\
**Post date:** [December 9, 2017, 9:40am UTC](https://forum.wixstudio.com/t/how-to-click-between-slides-by-clicking-my-own-button/14973/2 "2017-12-09T09:40:07Z")

</div>

Hay Croberts,

I guess you are using the slideshow? If so, it has an API to move to a specific slide - the [changeSlide](https://www.wix.com/code/reference/$w.Slideshow.html#changeSlide) API.

Have a button click event calling this API. To move to slide 5, the code will look something like the following (note that slide indexes are 0 based, so slide 5 is number 4) -

```javascript

export function BUTTON1_click() {
  $w('#SLIDESHOW1').changeSlide(4);
}

```

---

<div class="post-metadata">

**Author:** ![croberts](https://avatars.discourse-cdn.com/v4/letter/c/ccd318/32.png) [@croberts](https://forum.wixstudio.com/u/croberts)\
**Post date:** [December 9, 2017, 11:09am UTC](https://forum.wixstudio.com/t/how-to-click-between-slides-by-clicking-my-own-button/14973/3 "2017-12-09T11:09:30Z")

</div>

Yoav,

Thanks for your response. I tried this but it is not working. I have changed the ID of the slideshow to match my own ID and the slide numbers but still no luck? Is there any settings?

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/system/32/86885_2.png) [@system](https://forum.wixstudio.com/u/system)\
**Post date:** [December 10, 2017, 8:49am UTC](https://forum.wixstudio.com/t/how-to-click-between-slides-by-clicking-my-own-button/14973/4 "2017-12-10T08:49:08Z")

</div>

Hi crobert,

Can you please share your code for the click function?

Liran.

---

<div class="post-metadata">

**Author:** ![croberts](https://avatars.discourse-cdn.com/v4/letter/c/ccd318/32.png) [@croberts](https://forum.wixstudio.com/u/croberts)\
**Post date:** [December 10, 2017, 11:57pm UTC](https://forum.wixstudio.com/t/how-to-click-between-slides-by-clicking-my-own-button/14973/5 "2017-12-10T23:57:31Z")

</div>

export function Nextbutton\_click($w) {  
$w(“#mySlideshow”).changeSlide(0)

---

<div class="post-metadata">

**Author:** ![admin-23](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/admin-23/32/708_2.png) [@admin-23](https://forum.wixstudio.com/u/admin-23)\
**Post date:** [December 11, 2017, 10:22am UTC](https://forum.wixstudio.com/t/how-to-click-between-slides-by-clicking-my-own-button/14973/6 "2017-12-11T10:22:43Z")

</div>

Hi,

Have you added the click event from the properties panel ?  
See more [here](https://support.wix.com/en/article/working-with-events-in-wix-code)

---

<div class="post-metadata">

**Author:** ![croberts](https://avatars.discourse-cdn.com/v4/letter/c/ccd318/32.png) [@croberts](https://forum.wixstudio.com/u/croberts)\
**Post date:** [December 11, 2017, 8:52pm UTC](https://forum.wixstudio.com/t/how-to-click-between-slides-by-clicking-my-own-button/14973/7 "2017-12-11T20:52:02Z")

</div>

I have it! - thanks for the help. The code has to remove the $w in the brackets after the export function click - See below

export function Nextbutton\_click() {  
$w(“#mySlideshow”).changeSlide(0)

---

<div class="post-metadata">

**Author:** ![dariuszkasica](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/dariuszkasica/32/5312_2.png) [@dariuszkasica](https://forum.wixstudio.com/u/dariuszkasica)\
**Post date:** [July 4, 2018, 2:21pm UTC](https://forum.wixstudio.com/t/how-to-click-between-slides-by-clicking-my-own-button/14973/8 "2018-07-04T14:21:47Z")

</div>

I also have to say thank you very much because I used this code to make what I always wanted to make and no vendor has it - to have a nice described, pictured and highlighted buttons connected to the slides.  
But for now I have to multiply the number of buttons bar (the slideshow menu) to have the actual button highlighted. I would like to have only one bar and when the actual slide comes in - the corresponding button gets highlighted. Any ideas please ? 🙂

---

<div class="post-metadata">

**Author:** ![canute](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/canute/32/9739_2.png) [@canute](https://forum.wixstudio.com/u/canute)\
**Post date:** [January 26, 2021, 2:19pm UTC](https://forum.wixstudio.com/t/how-to-click-between-slides-by-clicking-my-own-button/14973/9 "2021-01-26T14:19:54Z")

</div>

I am not sure if this thread is still active but I suppose this solution can be useful for someone trying to do the same. Thus posted it here.

You can use the below code for performing the captioned task.

My full slider has 3 slides. I have inserted buttons respectively on each of the slides and have hidden the default arrows in the slider.

slide3home = Home button inserted in slide 3  
slide3woman = Woman button inserted in slide 3  
Have defined the above logic respectively in all 3 slides

The numbering for slide to use as reference is similar to python i.e.  
0 = Slide 1  
1 = Slide 2  
2 = Slide 3

Depending on how many slides you have you will have to use the reference for slides starting from 0.

export function slide3home\_click(event) {  
$w( " [#fullWidthSlides1](https://www.wix.com/velo/forum/search/~num~fullWidthSlides1) " ).changeSlide( 0 )  
}  
export function slide3woman\_click(event) {  
$w( " [#fullWidthSlides1](https://www.wix.com/velo/forum/search/~num~fullWidthSlides1) " ).changeSlide( 1 )  
}  
export function slide2man\_click(event) {  
$w( " [#fullWidthSlides1](https://www.wix.com/velo/forum/search/~num~fullWidthSlides1) " ).changeSlide( 2 )  
}  
export function slide2home\_click(event) {  
$w( " [#fullWidthSlides1](https://www.wix.com/velo/forum/search/~num~fullWidthSlides1) " ).changeSlide( 0 )  
}  
export function slide1woman\_click(event) {  
$w( " [#fullWidthSlides1](https://www.wix.com/velo/forum/search/~num~fullWidthSlides1) " ).changeSlide( 1 )  
}  
export function slide1man\_click(event) {  
$w( " [#fullWidthSlides1](https://www.wix.com/velo/forum/search/~num~fullWidthSlides1) " ).changeSlide( 2 )  
}

You can view the same here: [https://maveristic.wixsite.com/designerclothes](https://maveristic.wixsite.com/designerclothes)
