cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

            
              <div class="map">
  
  <div class="map-item map-item1">
    <a class="marker marker1" href="#marker1">1</a>

    <aside id="marker1" class="map-popup">
      <h3 class="popup-title">Popup Title</h3>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quia pariatur laudantium deserunt minima delectus illum dolor, nesciunt sit iure, debitis eligendi blanditiis, tempore quidem cupiditate quaerat incidunt sapiente aliquam? Debitis!</p>
      <a class="btn" href="#">Find Out More</a>
    </aside>
  </div>
  
  <div class="map-item map-item2">
    <a class="marker marker2" href="#marker2">2</a>

    <aside id="marker2" class="map-popup">
      <h3 class="popup-title">Popup Title</h3>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quia pariatur laudantium deserunt minima delectus illum dolor, nesciunt sit iure, debitis eligendi blanditiis, tempore quidem cupiditate quaerat incidunt sapiente aliquam? Debitis!</p>
      <a class="btn" href="#">Find Out More</a>
    </aside>
  </div>
  
  <img src="https://unsplash.it/800/480/?image=1082" alt="">
</div>
            
          
!
            
              body {
  font-family: 
    -apple-system, BlinkMacSystemFont, 
    "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", 
    "Helvetica Neue", sans-serif;
  font-size: 100%;
  line-height: 1.5;
}

img {
  max-width: 100%;
  height: auto;
}

.map {
  position: relative;
  max-width: 1100px;
  margin: auto;
  background-color: #ccc;
}
.map img {
  display: block;
  width: 100%;
}

.map-popup {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 99;
  width: 60%;
  padding: 2rem;
  background-color: #fff;
  transition: all 300ms ease-in;
  transform: translate(-50%,-50%);
  box-shadow: 0 0 24px rgba(0,0,0,0.22);
  opacity: 0;
  visibility: hidden;
}

.map-popup > *:first-child { margin-top: 0; }
.map-popup > *:last-child { margin-bottom: 0; }

.map-popup.open {
  opacity: 1;
  visibility: visible;
}

.marker {
  position: absolute;
  z-index: 1;
  display: inline-block;
  width: 36px;
  height: 36px;
  color: #fff;
  line-height: 36px;
  text-align: center;
  text-decoration: none;
  border-radius: 50%;
  background-color: tomato;
  transition: all 300ms;
}

.marker1 {
  top: 30%;
  left: 20%;
}
.marker2 {
  top: 50%;
  left: 64%;
}

@media only screen and (min-width:48em) {
  .map-item {
    position: absolute;
    width: 36px;
    height: 36px;
    }
    .map-item .marker {
      top: auto;
      left: auto;
    }
  
  .map-item1 {
    top: 30%;
    left: 20%;
  }
  .map-item2 {
    top: 50%;
    left: 64%;
  }
  
  .map-popup {
    position: absolute;
    left: 58px;
    width: 280px;
    transform: translateY(-50%);
  }
  .map-popup:before {
    content: "";
    position: absolute;
    top: 50%;
    left: -16px;
    margin-top: -16px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 16px 16px 16px 0;
    border-color: transparent #fff transparent transparent;
  }
  
  .map-popup.edge {
    left: auto;
    right: calc(100% + 24px);
  }
  .map-popup.edge:before {
    left: auto;
    right: -16px;
    border-width: 16px 0 16px 16px;
    border-color: transparent transparent transparent #fff;
  }
}
            
          
!
            
              jQuery(function($) {
  var pop = $('.map-popup');
  pop.click(function(e) {
    e.stopPropagation();
  });
  
  $('a.marker').click(function(e) {
    e.preventDefault();
    e.stopPropagation();
    $(this).next('.map-popup').toggleClass('open');
    $(this).parent().siblings().children('.map-popup').removeClass('open');
  });
  
  $(document).click(function() {
    pop.removeClass('open');
  });
  
  pop.each(function() {
    var w = $(window).outerWidth(),
        edge = Math.round( ($(this).offset().left) + ($(this).outerWidth()) );
    if( w < edge ) {
      $(this).addClass('edge');
    }
  });
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console