업데이트:

마우스및키다운 & IFRAME관련 부모요소 제어

$(function() {
  /* layer popup */
  $(".interviewList .listCell a").on("click", function(e) {
    $(".nLayerPop").show();
    e.preventDefault();
    disableWheel();
  });

  $(".nLayerPop .dim").on("click", function() {
    $(".nLayerPop").hide();
    enableWheel();
  });
});
//이벤트 제거
function disableWheel() {
  document.onmousewheel = function() {
    stopWheel();
  }; /* IE7, IE8 */
  document.onkeydown = function() {
    stopWheel();
  };
  if (document.addEventListener) {
    /* Chrome, Safari, Firefox */
    document.addEventListener("DOMMouseScroll", stopWheel, false);
    document.addEventListener("keydown", stopWheel, false);
  }
}
//이벤트 제거 취소
function enableWheel() {
  document.onmousewheel = null; /* IE7, IE8 */
  document.onkeydown = null;
  if (document.addEventListener) {
    /* Chrome, Safari, Firefox */
    document.removeEventListener("DOMMouseScroll", stopWheel, false);
    document.removeEventListener("keydown", stopWheel, false);
  }
}
//실제 이벤트제어
function stopWheel(e) {
  if (!e) {
    e = window.event;
  } /* IE7, IE8, Chrome, Safari */
  if (e.preventDefault) {
    e.preventDefault();
  } /* Chrome, Safari, Firefox */
  e.returnValue = false; /* IE7, IE8 */
}

/* iframe content */
var parentDocument = document;
document.getElementById("interviewFrame").onload = function() {
  var document = this.contentWindow.document;
  document.getElementById("close").onclick = function(e) {
    parentDocument.getElementById("interviewPopup").style.display = "none";
    enableWheel();
  };
};

댓글남기기