Skip to content

Instantly share code, notes, and snippets.

@syusui-s
Last active September 7, 2021 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syusui-s/3faf6a8adc3f589a97f55d87c93bcde9 to your computer and use it in GitHub Desktop.
Save syusui-s/3faf6a8adc3f589a97f55d87c93bcde9 to your computer and use it in GitHub Desktop.

Scrapbox Sticky Video

  • ScrapboxでYouTube等の動画を上部に固定表示できるようにするUserStyle/UserCSSです。
  • lefb766/scrapbox-video-seek-buttonと組み合わせて使うことを意図しています。
  • CC0 ライセンスで公開します。
code:style.css
  .video-line {
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1;
    background: white;
    text-align: center;
  }

  .iframe-video-player {
    width: 100%;
  }
code:script.js
  setInterval(() => {
    const videoContainers = document.querySelectorAll('.iframe-video-player');
    [...videoContainers].forEach(videoContainer => {
      const lineElem = videoContainer.parentElement.parentElement.parentElement;
      lineElem.classList.add('video-line');
    });
  }, 2000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment