Javascript image toggle

Here is my code.
https://codepen.io/somen18/pen/eYBvwZj

What I want to do after double click the selected image will be deselected. I want to do this with the toggle. Can anyone give me a hint ?

This is very easy to do, because you’re already checking if the newly selected image is already in your sliders array. If it is, instead of showing the alert, you can just filter your sliders array to remove the current image:
sliders.filter(img => img !== item)

BTW you probably don’t want to publically share your API key, here’s an article that explains how to hide your secret key when using codepen: https://blog.codepen.io/2017/08/10/window-prompt-localstorage-api-keys/