I want the popup modal opening where the box is .For the top 2 boxes placed the modal opens correctly , I was trying for the last 2 boxes placed at bottom as well.
try to use your variable with getBoundingClientRect, little example, change:
this.modelstyle { top: 0 + px; ...here other your code... }
to
this.modelStyle { top: x.top + window.scrollY + 'px', ...here other your code... }