Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <header>
  <div id="darkBack"></div>
  <div id="popUp">
    <div id="close" class="close"><i class="fa fa-times"></i></div>
    <div id="new"><span>NEW!</span></div>
    <h2>I'm a notification popup that isn't too distracting or in your face. Scroll down or close me and I will go away. You'll still be able to open me later on don't worry.</h2>
    <br>
    <a href="#" target="_blank" class="button">Visit Page</a>
  </div>
  <div id="plus"><span>NEW<br>&nbsp;&nbsp;<i class="fa fa-plus"></i></span></div>
</header>

<div id="body"></div>
              
            
!

CSS

              
                * {
  margin: 0;
  font-family: 'Source Sans Pro', sans-serif;
}

a {
  text-decoration: none;
}

header {
  background: url(http://cdn.magdeleine.co/wp-content/uploads/2015/08/9524476479_ef867c36a4_o-1400x935.jpg);
  background-size: cover;
  background-position: center;
  height: 100vh;
  width: 100%;
}

#darkBack {
  width: 100%;
  height: 100vh;
  background: rgba(76, 56, 75, .15);
}

#popUp {
  position: fixed;
  max-width: 350px;
  height: 225px;
  background: rgba(236, 240, 241, 1);
  border: 7px solid #fff;
  bottom: 0;
  margin-left: 0;
  -webkit-transition: all 1s ease;
  -moz-transition: all 1s ease;
  -o-transition: all 1s ease;
  transition: all 1s ease;
}

#new span {
  background: #fff;
  position: absolute;
  color: #1c8dc4;
  padding: 4px 10px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  margin-top: -5px;
}

#popUp .close {
  color: #464646;
  right: 8px;
  top: 0px;
  position: absolute;
  font-size: 20px;
  cursor: pointer;
}

#popUp h2 {
  font-size: 17px;
  color: #464646;
  line-height: 24px;
  font-weight: 400;
  text-align: center;
  margin-top: 40px;
  padding: 0 20px;
}

#body {
  height: 1200px;
  background: #eee;
}

a.button {
  margin: 0 auto;
  text-align: center;
  right: 0;
  left: 0;
  position: absolute;
  width: 120px;
  font-size: 15px;
  color: #fff;
  border-bottom: 2px solid #18729f;
  background: #1c8dc4;
  border-radius: 4px;
  padding: 8px 0;
}

#plus {
  position: fixed;
  color: #fff;
  bottom: 15%;
  font-size: 15px;
  margin-left: -425px;
  -webkit-transition: all 1.25s ease;
  -moz-transition: all 1.25s ease;
  -o-transition: all 1.25s ease;
  transition: all 1.25s ease;
  cursor: pointer;
  text-align: left;
  letter-spacing: 1px;
}

#plus span {
  position: absolute;
  margin-top: 38px;
  left: 4px;
}

#plus::after {
  content: '';
  display: block;
  display: relative;
  border-top: 55px solid transparent;
  border-bottom: 55px solid transparent;
  border-left: 55px solid #1c8dc4;
}

@media all and (max-width: 900px) {
  #popUp {
    margin-left: -425px;
  }
  #plus {
    margin-left: 0px;
  }
}
              
            
!

JS

              
                $(document).scroll(function() {
  var scroll = $(this).scrollTop();
  if (scroll >= 150) {
    $("#popUp").css("margin-left", "-425px");
    $("#plus").css("margin-left", "0px");
  }
});

$("#plus").click(function() {
  $("#popUp").css("margin-left", "0px");
  $("#plus").css("margin-left", "-425px");
});

$("#close").click(function() {
  $("#popUp").css("margin-left", "-425px");
  $("#plus").css("margin-left", "0px");
});
              
            
!
999px

Console