Answers for "mutationobserver js"

4

mutationobserver js

var targetNode = document.getElementById('myID');
var config = { attributes: true };
var observer = new MutationObserver(function (mutations) {
  for (let mutation of mutations) {
    if (targetNode.style.visibility == 'visible') {
      document.getElementById('myID1').style.display = 'block';
      document.getElementById('myID2').style.display = 'block';
    }
    else {
      document.getElementById('myID1').style.display = 'none';
      document.getElementById('myID2').style.display = 'none';
    }
  }
});

observer.observe(targetNode, config);
Posted by: Guest on October-13-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language