💻 :: Don't scroll both iFrames with mouse scroll key.

PHOTO EMBED

Sat Oct 19 2024 02:26:45 GMT+0000 (Coordinated Universal Time)

Saved by @ghostbusted #javascript #chromeconsole

(function() {
  // Find the iframe
  const iframe = document.querySelector('iframe[src^="https://docs.google.com/spreadsheets"]');
  if (!iframe) {
    console.error('Google Spreadsheet iframe not found');
    return;
  }

  // Create a container for the iframe
  const container = document.createElement('div');
  container.className = 'spreadsheet-container';
  iframe.parentNode.insertBefore(container, iframe);
  container.appendChild(iframe);

  // Apply styles
  const style = document.createElement('style');
  style.textContent = `
    .spreadsheet-container {
      width: 100%;
      height: 560px;
      overflow: hidden;
    }
    .spreadsheet-container iframe {
      width: 100%;
      height: 100%;
      border: none;
    }
    body {
      overflow: hidden;
    }
  `;
  document.head.appendChild(style);

  // Add event listeners
  container.addEventListener('wheel', function(e) {
    e.preventDefault();
    iframe.contentWindow.scrollBy(e.deltaX, e.deltaY);
  }, { passive: false });

  container.addEventListener('mouseenter', function() {
    document.body.style.overflow = 'hidden';
  });

  container.addEventListener('mouseleave', function() {
    document.body.style.overflow = 'auto';
  });

  console.log('Spreadsheet scrolling behavior modified successfully');
})();
content_copyCOPY

https://frontdesk.mykaplan.tv/frontdesk-home/ (Ctrl+Shift+i > Console)

https://frontdesk.mykaplan.tv/frontdesk-home/