Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div id="visual_header" class="background">
  <div class="background-wrap">
    <div class="background-movie">
      <div id="background-movie-player"></div>


                .background {
  background: url( no-repeat center center;
  background-size: cover;
  position: relative;
  z-index: -2;
  width: calc(100vh * 1.78);
  height: 100vh;
  margin: 0 auto;
  .background-wrap {
    position: relative;
    top: 0;
    left: 0;
    z-index: -1;
    min-width: 100%;
    min-height: 100%;
    overflow: hidden;
    .background-movie {
      position: relative;
      display: flex;
      justify-content: center;
    #background-movie-player {
      width: calc(100vh * 1.78);
      height: 100vh;
      flex: none;


                // YouTube IFrame Player API の読み込み
var tag = document.createElement('script');
tag.src = "";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

// YouTubeの埋め込み
var ytPlayer;
function onYouTubeIframeAPIReady() {
  ytPlayer = new YT.Player(
    'background-movie-player', // 埋め込む場所の指定
      playerVars: {
        playsinline: 1,
        autoplay: 1, // 自動再生
        loop: 1, // ループ有効
        listType: 'playlist', //リスト再生
        list: 'PLYpUhFEzQAcTwTxvxx04al09DDKjnDuZT', // 再生する動画リスト
        controls: 0, // コントロールバー非表示
        enablejsapi: 1, //JavaScript API 有効
        iv_load_policy: 3, //動画アノテーションを表示しない
        disablekb:1, //キーボード操作OFF
        showinfo:0, //動画の再生が始まる前に動画のタイトルなどの情報を表示しない
        rel:0, //再生終了時に関連動画を表示しない
      events: {
        'onReady': onPlayerReady,
        'onStateChange': onPlayerStateChange,
        'onError': onPlayerError

// プレーヤーの準備ができたとき
function onPlayerReady(event) {
  // 動画をミュートにする
  const player =;

// onStateChangeのコールバック関数
function onPlayerStateChange(event) {
  var status =;
  var playerWrap = $('#header .background-wrap');
  var names = {
    '-1' : '未開始',
    '0' : '終了',
    '1' : '再生中',
    '2' : '停止',
    '3' : 'バッファリング中',
    '5' : '頭出し済み'
  if (status == 1) {
  } else {

// errorの発生時
function onPlayerError(event) {
  var errorstatus =;
  var playerWrap = $('#header .background-wrap');
  if (errorstatus !== '') {