Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css" type="text/css" />
<div class="startbar">
  <div id="startbutton" class="startbutton-off">
    <b>Start</b>
  </div>
  <div class="time">
  </div>
</div>

<div id="menu">
  <div class="sidebar"></div>
  <div class="headline"><b>Windows</b> 98
  </div>
  <ul class="menu-content">
    <li class="item more" data-icon="https://res.cloudinary.com/penry/image/upload/v1474990247/directory_program_group_small_fqw8rr.ico">Programs
      <ul class="dropdown-content">
        <li class="dropdown-item" data-icon="https://res.cloudinary.com/penry/image/upload//w_65,h_65,c_lpad/v1474990266/msie2_ks3wek.png">Internet Explorer</li>
        <li class="dropdown-item" data-icon="https://res.cloudinary.com/penry/image/upload/v1474990270/notepad_file_kf9wqx.ico">Notepad</li>
        
      </ul>
    </li>
    <li class="item more" data-icon="https://res.cloudinary.com/penry/image/upload/w_65,h_65,c_lpad/v1474990246/directory_pictures_ualddt.png">Photos
      <ul class="dropdown-content">
        <li class="dropdown-item launch" data-launch="pepe" data-title="Rare Pepe.jpg" data-icon="https://res.cloudinary.com/penry/image/upload/q_100/v1474990272/pictures_bt9tfg.ico" data-url="http://penry.me/projects/windows98/rarepepe/">Rare Pepe.jpg
        </li>
        
        <li class="dropdown-item launch" data-launch="dank" data-title="Requiem for a meme.gif" data-icon="https://res.cloudinary.com/penry/image/upload/q_100/v1474990272/pictures_bt9tfg.ico" data-url="http://penry.me/projects/windows98/requiem/">Requiem for a meme.gif</li>
      </ul>
    </li>
    <li class="item more" data-icon="https://res.cloudinary.com/penry/image/upload//w_40,h_40,c_lpad/v1474990234/cd_audio_cd_mcloiq.png">Music
    <ul class="dropdown-content">
      <li class="dropdown-item launch" data-launch="420" data-title="MACINTOSH PLUS - リサフランク420 / 現代のコンピュー.mp3" data-icon="https://res.cloudinary.com/penry/image/upload/v1474990282/SoundYel_aunogm.ico" data-url="https://s.codepen.io/penry/debug/KgWVbQ">MACINTOSH PLUS 420.mp3</li>
      </ul>
    </li>
    <li class="item more" data-icon="https://res.cloudinary.com/penry/image/upload/c_lpad,g_center,r_0,w_65/v1474990261/media_player_file_sqjlgm.png">Videos
      <ul class="dropdown-content">
        <li class="dropdown-item launch" data-launch="sundaySchool" data-title="SUNDAY SCHOOL.mp4" data-icon="https://res.cloudinary.com/penry/image/upload/v1474990261/media_player_file_sqjlgm.png" data-url="https://www.youtube.com/embed/rTfa-9aCTYg">SUNDAY SCHOOL.mp4</li>
        <li class="dropdown-item launch" data-launch="kungFury" data-title="KUNG FURY.mp4" data-icon="https://res.cloudinary.com/penry/image/upload/v1474990261/media_player_file_sqjlgm.png" data-url="https://www.youtube.com/embed/bS5P_LAqiVg">KUNG FURY.mp4</li>
      
      </ul>
    </li>
    <li class="item" data-icon="https://res.cloudinary.com/penry/image/upload/q_100/v1474990280/settings_gear_zxd7tf.ico">Settings</li>
    <li class="item" data-icon="https://res.cloudinary.com/penry/image/upload/q_100/v1474990279/search_file_2_yy4muv.ico">Find</li>
    <li class="item" data-icon="https://res.cloudinary.com/penry/image/upload/v1474990254/help_book_small_ra0uhc.ico">Help</li>
    <li class="item" data-icon="https://res.cloudinary.com/penry/image/upload/v1474990231/application_hourglass_small_yyhy5z.ico">Run</li>
    <li class="item" data-icon="https://res.cloudinary.com/penry/image/upload/v1474990258/key_win_anpnfo.ico">Log off</li>
    <li class="item" data-icon="https://res.cloudinary.com/penry/image/upload/v1474990281/shut_down_normal_t24or4.ico">Shutdown</li>
  </ul>
</div>


<div class="desktop">
 </div>


              
            
!

CSS

              
                * {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: helvetica;
}


/* JQuery ui icom removal */ 
.ui-icon { background-image: url("") !important; }

.desktop {
  height: 100vh;
  width: 100vw;
  background-color: #007d7b;
  background-image: url('');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  overflow: hidden;
  position: fixed; 
  z-index: -999;
}

.startbar {
  position: fixed;
  bottom: 0;
  left: 0;
  display: block;
  height: 38px;
  width: 100vw;
  background-color: #bdbebd;
  border-top: 2px solid white;
  padding: 3px;
}

#startbutton {
  float: left; 
  display: inline-block;
  text-decoration: none;
  color: black;
  width: 70px;
  height: 29px;
  text-align: right;
  font-family: sans-serif;
  padding: 4px;
  background-image: url("http://vignette2.wikia.nocookie.net/logopedia/images/3/32/Microsoft_Windows_Compatible_Icon.png/revision/latest/scale-to-width-down/303?cb=20160806162438");
  background-size: auto 70%;
  background-position: 5% 50%;
  background-repeat: no-repeat;
}

.startbutton-off {
  border-top: 2px solid white;
  border-left: 2px solid white;
  border-right: 2px solid black;
  border-bottom: 2px solid black;
}

.startbutton-on {
  border-top: 2px solid black;
  border-left: 2px solid black;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
}

#menu {
  position: absolute;
  bottom: 35px;
  left: 3px;
  background-color: #bdbebd;
  z-index: 10;
  border-left: 2px solid white;
  border-top: 2px solid white;
  border-right: 2px solid grey;
  border-bottom: 2px solid grey;
  display: none;
}


.sidebar {
  height: 100%;
  background: linear-gradient(to bottom, #000080, #1084d0);
  display: inline-block;
  width: 25px;
  bottom: 0;
  left: 0;
  position: absolute;
}

.headline {
  transform: rotate(-90deg);
  transform-origin: 0% 0%;
  width: 150%;
  padding-top: 4px;
  padding-bottom: 3px;
  padding-left: 0px;
  color: white;
  position: absolute;
  left 0;
  bottom: 0;
  text-align: left;
  margin-bottom: -15px;
}

.item {
  padding-top: 12px;
  padding-bottom: 12px;
  padding-left: 40px;
  padding-right: 70px;
  font-size: 13px;
  margin-left: 25px;
  background-size: auto 80%;
  background-position: 5px 50%;
  background-repeat: no-repeat;
}

.more {
  position: relative; 
  list-style: none;
}

.more::after {
  content: "►";
  left: 65px;
  position: relative;
  float: right;
}



.dropdown-content {
  display: none;
  position: absolute;
}

.more:hover .dropdown-content {
  display: block;
  
  top: -2px;
  left: 100%;
  background-color: #bdbebd;
  color: black;
  list-style: none;
  border-left: 2px solid white;
  border-top: 2px solid white;
  border-right: 2px solid grey;
  border-bottom: 2px solid grey;
  box-sizing: border-box;
  min-width: 100%;
  
}

  .dropdown-item {
  padding-top: 6px;
  padding-bottom: 6px;
  padding-left: 40px;
  padding-right: 10px;
  font-size: 13px;
  background-size: auto 70%;
  background-position: 5% 50%;
  background-repeat: no-repeat;
  white-space:nowrap;
   
}

.dropdown-item:hover {
  color: white;
  background-color: darkblue;
}

.item:hover {
  background-color: darkblue;
  color: white;
}

.item:first-child {}

.item:last-child {}

.menu-break::after {
  content: "";
  border-top: 1px solid white;
  height: 1px;
  display: block;
}

.time {
  display: inline-block;
  height: 29px;
  float: right;
  text-align: center;
  padding: 4px;
  border-top: 2px solid grey;
  border-left: 2px solid grey;
  border-bottom: 2px solid white;
  border-right: 2px solid white;
}

.window {
  
   background-color: #BDBEBD;
  border-left: 1px solid white;
  border-bottom: 1px solid black;
  border-top: 1px solid white;
  border-right: 1px solid black;
  box-shadow: 2px 2px 10px 0px rgba(0, 0, 0, 0.75);
  display: none;
  
}

.window-inner {
  border: 2px solid #BDBEBD;
  height: 100%;
}

.window-header {
  background: linear-gradient(to right, #000080, #1084d0);
  font-size: 15px;
  overflow: auto; 

 
}

.window-header p {
  color: white;
  display: inline;
  position: absolute;
  vertical-align: middle;
  display: inline;
  overflow: hidden;
  white-space: nowrap;
  width: calc(100% - 105px);
  padding-top: 3px; 
  padding-left: 3px; 
}




.window-icon {
  width: 20px;
  height: 20px;
  background-color: #BDBEBD;
  display: inline-block;
  float: right;
  border-top: 1px solid white;
  border-left: 1px solid white;
  border-bottom: 1px solid black;
  border-right: 1px solid black;
 
  text-align: center;
  margin-top: 3px;
  margin-right: 3px;
  margin-bottom: 3px;
}

.close {
  background-image: url("https://res.cloudinary.com/penry/image/upload/q_100/v1475278244/close_jw5cay.png");
  background-size: auto 100%;
  background-position: 50% 50%;
  background-repeat: no-repeat;
  }

.maximise {
  background-image: url("https://res.cloudinary.com/penry/image/upload/q_100/v1475278244/maximise_anhbyl.png");
  background-size: auto 100%;
  background-position: 50% 50%;
  background-repeat: no-repeat;
  }

.minimise {
  background-image: url("https://res.cloudinary.com/penry/image/upload/q_100/v1475278244/minimise_p60zap.png");
  background-size: auto 100%;
  background-position: 50% 50%;
  background-repeat: no-repeat;
  }


.window-content {
  margin-top: 2px;
  border: 2px solid #808080;
  border-bottom: 2px solid white;
  border-right: 2px solid white;
  height: calc( 100% - 28px);

}

.program {
  float: left;
  display: block; 
  margin-left: 5px; 
  height: 29px;
  width: 200px;
  text-align: left;
  padding: 4px;
  padding-left: 30px;
  border-top: 2px solid white;
  border-left: 2px solid white;
  border-bottom: 2px solid black;
  border-right: 2px solid black;
  background-color: #BDBEBD;
  box-sizing: border-box; 
  overflow: hidden;
  white-space: nowrap;
  
  background-size: auto 70%;
  background-position: 3px 50%;
  background-repeat: no-repeat;
  
  
}

.window-header-icon {
  height: 20px; 
  margin-left: 3px;
  margin-top: 3px;
  display: inline-block; 
}

.focused {
  border-top: 2px solid black;
  border-left: 2px solid black;
  border-bottom: 2px solid white;
  border-right: 2px solid white;
}




              
            
!

JS

              
                function updateClock() {
  var time = new Date();
  var hours = time.getHours();
  var minutes = time.getMinutes();
  var suffix = "AM";

  if (minutes < 10) {
    // prefix 0 
    minutes = "0" + minutes;
  }
  if (hours === 0) {
    hours = "12"
  } else if (hours === 12) {
    suffix = "PM";
  } else if (hours > 12) {
    hours = hours % 12;
    suffix = "PM";
  }

  var currentTime = hours + ":" + minutes + " " + suffix;
  $(".time").html(currentTime);
}

var getTopZIndex = function() {
  var allDivs = $('.window');
  var topZindex = 0;
  var topDivId;
  allDivs.each(function() {
    var currentZindex = parseInt($(this).css('z-index'));
    if (currentZindex > topZindex) {
      topZindex = currentZindex;
      topDivId = this.id;
    }
  });
  return topZindex;

};

var openWindow = function(id) {
  $("#" + id).show();
  $("#" + id).css('z-index', getTopZIndex() + 1);
};

//Dynamically create start bar button and unhide program window already loaded in dom 
var createProgram = function(id, title, imgUrl, url) {
  $("#startbutton").after("<span class='program' id='start-bar-" + id + "' >" + title + "</span>");
  $("#start-bar-" + id).css('background-image', 'url(' + imgUrl + ')');
  var content = '<div class="window ui-widget" id="' + id + '">' +
    '<div class="window-inner">' +
    '<div class="window-header"><img class="window-header-icon" src="' + imgUrl + '" />' +
    '<p>' + title + '</p>' +
    ' <div class="window-icon close" ></div>' +
    ' <div class="window-icon maximise" ></div>' +
    ' <div class="window-icon minimise" ></div>' +
    '</div>' +
    '<div class="window-content" id="' + id + '-content">' +
    '<iframe width="100%" height="100%" src="' + url + '" frameborder="0" allowfullscreen></iframe>'
  '</div>' +
  '</div>' +
  '</div>';
  $(".desktop").after(content);
  $(".window").draggable({
    handle: ".window-header",
    cursor: "move",
    containment: "window",
    stack: ".window"
  });
  $(".window").resizable({
    handles: "n, e, s, w, ne, se, sw, nw",
    minHeight: 250,
    minWidth: 350
  });
  // Prevent windows from moving on sibling being resized or closed
  $(".window").css({
    position: "absolute"
  });
  openWindow(id);
};

var isWindowMaximised = function(id) {
  var targetId = $("#" + id);
  console.log("desktop width " + $(window).width());
  console.log("window width " + targetId.outerWidth());
  if (targetId.outerWidth() < $(window).width()) {
    return false;
  } else //(targetId.outerWidth() $(window).width) 
  {
    return true;
  }
}

var isWindowOpen = function(id) {

  if ($("#start-bar-" + id).length > 0) {
    return true;
    console.log("window open");
  } else {
    return false;
    console.log("window does not exist");

  }
};

var closeProgram = function(id) {
  $("#start-bar-" + id).remove();
  $("#" + id).remove();
};

var minimiseProgram = function(id) {
  $("#start-bar" + id).toggleClass("focused");
};

var maximiseWindow = function(id) {
  var targetId = $("#" + id);

  var originalPos = {
    left: targetId.position().left,
    top: targetId.position().top,
    width: targetId.width(),
    height: targetId.height()
  };

  targetId.draggable("disable");
  targetId.resizable("disable");

  targetId.data("top", originalPos.top);
  targetId.data("left", originalPos.left);
  targetId.data("height", originalPos.height);
  targetId.data("width", originalPos.width);

  targetId.css({
    top: 0,
    left: 0,
    width: $(window).width(),
    height: $(window).height() - 38
  });

};

var unMaximiseWindow = function(id) {
  var targetId = $("#" + id);

  targetId.draggable("enable");
  targetId.resizable("enable");

  targetId.css({
    top: targetId.data("top"),
    left: targetId.data("left"),
    width: targetId.data("width"),
    height: targetId.data("height")
  })
}

var setIcon = function() {
  if ($(this).data("icon")) {
    var icon = $(this).data("icon");
    $(this).css('background-image', "url(" + icon + ")");
  } else {
    console.log("no icon supplied")
  }

}

$(document).ready(function() {

  setInterval(updateClock(), 1000);
  //start up music
  var audio = new Audio('http://www.winhistory.de/more/winstart/ogg/win98.ogg');
  //audio.play();
  // toggle start menu 
  $("#startbutton").click(function() {
    $("#startbutton").toggleClass("startbutton-on");
    $('#menu').toggle();
  });

  // close start menu if desktop clicked
  $(".desktop").click(function() {
    // Depress windows start button animation 
    $("#startbutton").removeClass("startbutton-on");
    // hide start menu 
    $('#menu').hide();
  });

  // bind event listeners to programs in task
  $(".startbar").on("click", ".program", function(event) {
    // identify program id that is currently clicked
    var id = $(this).attr('id');
    var windowId = id.substring(10);
    console.log(windowId);
    // is program window currently open? 
    if ($("#" + windowId).is(':visible')) {
      // window is open
      console.log(windowId + " is visible")
      var z = getTopZIndex();
      var windowZ = $("#" + windowId).css("z-index");
      console.log(windowZ)
        // is window top of stack on desktop?
      if ($("#" + windowId).css("z-index") == z) {
        // window is at the top
        console.log(windowId + " is at top of stack")
          // minimise window
        $("#" + windowId).hide();
      }
      if ($("#" + windowId).css("z-index") < z) {
        // window is open, but not at top. 
        console.log("else condition fired pepe show");
        // bring window to front
        openWindow(windowId);
      }
    } else {
      // window is minimised, open window, bring to front of stack.  
      openWindow(windowId);
    }
  });

  // bind closeProgram function to all windows. 
  $(document.body).on("click", ".close", function(event) {
    var target = $(this).parent().parent().parent();
    //console.log(target.attr('id'));
    var targetId = target.attr('id');
    closeProgram(targetId);
  });

  $(document.body).on("click", ".minimise", function(event) {
    var target = $(this).parent().parent().parent();
    console.log(target.attr('id'));
    var targetId = target.attr('id');
    $("#" + targetId).hide();
  });

  $(document.body).on("click", ".maximise", function(event) {
    var target = $(this).parent().parent().parent();
    var targetId = target.attr('id');
    console.log(targetId);
    if (!isWindowMaximised(targetId)) {
      maximiseWindow(targetId);
      console.log("maximising window");
    } else if (isWindowMaximised(targetId)) {
      unMaximiseWindow(targetId);
      console.log("unmaximise window");
    } else {
      console.log("error");
    }
  });

  // bring window to front of stack when clicked. 
  $(document.body).on("click", ".window", function(event) {
    var target = $(this).attr('id');
    var z = getTopZIndex();
    $("#" + target).css("z-index", z + 1);
  });

  $("#menu").on("click", ".launch", function(event) {
    console.log($(this).data("launch"));
    var targetId = $(this).data("launch");
    var title = $(this).data("title");
    var imgUrl = $(this).data("icon");
    var url = $(this).data("url");
    if (!isWindowOpen(targetId)) {
      createProgram(targetId, title, imgUrl, url);
      $('#menu').hide();
      $("#startbutton").removeClass("startbutton-on");
    } else {
      openWindow(targetId);
      $('#menu').hide();
      $("#startbutton").removeClass("startbutton-on");
      console.log("program already exists... opening window")
    }
  });

  $(".item").each(function() {
    if ($(this).data("icon")) {
      var icon = $(this).data("icon");
      $(this).css('background-image', "url(" + icon + ")");
    } else {
      console.log("no icon supplied")
    }
  });

  $(".dropdown-item").each(function() {
    if ($(this).data("icon")) {
      var icon = $(this).data("icon");
      $(this).css('background-image', "url(" + icon + ")");
    } else {
      console.log("no icon supplied")
    }
  });

}); // end document ready
              
            
!
999px

Console