A
A
Armenjan12020-04-26 16:47:21
JavaScript
Armenjan1, 2020-04-26 16:47:21

Jquery modal image works fine only the first time, how to solve?

Hello, friends. I created a modal image that when changing the image works fine only the first time, and then, when we close the modal window and open it again, the image change does not work correctly. Please help solve this problem. Here is the link https://jsfiddle.net/no4w2a71

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-04-26
@Armenjan1

With each click on the images, you add click handlers to the buttons. As a result, how many times the window is opened - so many button handlers will hang. And when clicked, all of them will be executed, and each one will make +/- 1 to the current index.
Take out and beyond . $('#m_prev').click$('#m_next').click$('.norutyun img').click

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question