Streaming live at 10am (PST)

Catch CMS items with JavaScript



I'm working on the website for the client and I have problem with CMS/JavaScript

I have dynamic list which shows 4 images. Then if user clicks on the image it shows him popup(which is inside of each image but has display-none). I added ID to popup. I want to make overflow hidden for body when pop-up is open(display-block).

The problem is that when I make: var pupUp = document.getElementById("pupUpWraper") it only works for first CMS image. How can I make it work for all pop-ups? Should I use getElementByClassName?

Best regards,
Michal Maciejewski

Here is my public share link: LINK
(how to access public share link)


Yes, IDs MUST BE UNIQUE. getElementsByClassName() will return an array of elements, so you will need to loop through the list.