Div popup

by snowMonkey

HTML

<div class="m1" onclick="basicPopup('',this);">Text text text text
  <p>
    <a href="http://stackoverflow.com">Link 1</a>
  </p>
</div>

<div class="m1" onclick="basicPopup('',this);">
Text2 text2 text2 text2
  <p>
    <a href="http://stackoverflow.com">Link 1</a>
  </p>
</div>

CSS

.m1 {
  background-color: #fc0;
  width: 10em;
  height: 10em;
  margin-bottom: .3em;
}

JavaScript

function basicPopup(url, t1) {
let popupWindow;
  if (popupWindow && popupWindow.document.body.innerHTML == t1.innerHTML) {
    return false; //if equal do nothing
  }
  popupWindow = window.open(url, 'popUpWindow', 'height=500,width=500,left=100,top=100, resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes');
  popupWindow.document.body.innerHTML = t1.innerHTML;
  popupWindow.onUnload = function(){
    popupWindow = null;
  }
}