startv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource
via CSS Lint

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource
via JS Hint

Code Indentation

     

Save Automatically?

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

Want a Run Button?

If active, the preview will update automatically when you change code.

HTML

            
              <section>
  
  <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam.</p>

<div class="popup-info">
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/icon_7455.svg" class="popup-icon">
  <p>More information and stuff. Very important. Must read.</p>
</div>

</section>  

<section>
  
  <p>Saepe provident nesciunt fuga quae natus doloribus exercitationem quam quod cumque quia tempore unde omnis quibusdam magnam non aliquid inventore aperiam. Dolorum explicabo totam unde voluptates iure itaque veniam porro.</p>

<div class="popup-info">
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/icon_7455.svg" class="popup-icon">
  <p>More information and stuff. Very important. Must read.</p>
</div>

</section>  
            
          
!

CSS

            
              @import url(http://fonts.googleapis.com/css?family=Alegreya+Sans);
* { box-sizing: border-box; }
body {
  font-family: 'Alegreya Sans', sans-serif;
  width: 200px;
  margin: 20px auto;
}
section {
  position: relative;
}

.popup-info {
  width: 200px; 
  color: white;
  text-align: center;
  padding: 1rem;
  max-height: 0;
  position: absolute;
  top: 0;
  left: 100%;
  transition: 0.3s;
  overflow: hidden;
  > .popup-icon {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 1;
    width: 20px;
    transition: 0.3s;
  }
  p {
    display: none;
  }
  &.open {
    background: #F06D06;
    position: absolute;
    max-height: 300px;
    padding-top: 70px;
    z-index: 1;
    .popup-icon {
      top: 15px;
      left: 50%;
      width: 40px;
      margin-left: -20px;
    }
    p {
      display: block;
    }
  }
}
            
          
!

JS

            
              $(".popup-info").on("click", function() {
  $(this).toggleClass("open");
  return false;
});
            
          
!
999px
Loading ..................

Console