R
R
Rasul Gitinov2018-02-13 10:48:52
JavaScript
Rasul Gitinov, 2018-02-13 10:48:52

Why does the open window function not work correctly?

I'm practicing with jQuery and stumbled upon a problem.

I tried to make a function in which, using the "data-popup" HTML attribute, when a button is pressed, the corresponding pop-up will open. But for some reason, both windows open when you click.

Link to the code in CodePen

What is the problem and how can I find such errors myself in the future?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2018-02-13
@raselgit

$popup  = $('.popup__wrapper'); // запомнили все попапы
popupData = $popup.data(dataKey, dataValue); // записали им что-то в data-атрибут, хз зачем
popupData.addClass('popup__wrapper_show'); // показали запомненные попапы (все)

looking through line after line to think about what she is doing and why.
When there are too many lines, breakpoints will come to the rescue to find out at which stages everything goes “as it should”, and at which it goes awry.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question