Keeping elements synced in breakpoints


(Hrishikesh Kokate) #1

I created a webpage in Hype (at 1200px) and now, its responsive layout (420px). I needed to add another element and use JS to hide and show an element based on certain conditions. So, I added the element in 420px layout, set the element ID, used JS and I was done, until I switched to1200px to edit its layout in that breakpoint, but, saw that the element wasn’t there. I went ahead and created the element again in 1200px, but, now, I can’t use the same element ID. I don’t have much problems in assigning another element ID and modifying the JS, but, I feel that this should not be like this? Any way around it?


#2

In this situation, it’s best to use classes to identify multiple elements. Since elements in layouts are unique dom Elements you’ll need to give them a class. Here’s an example:


(Hrishikesh Kokate) #3

Yeah, that’s a workaround. But, since adding a new layout keeps all the elements present at that time, I thought, when adding a new element to the existing breakpoint, should get added to all the breakpoints, because we can anyways hide them if we don’t need them.

Thanks for the solution, anyways.