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

              
                <div class="tooltip">North American Countries</div>
<div class="container">
  <img src="https://i.ibb.co/vcSnbGd/amcharts-pixel-Map-1.png" alt="World Map">
  <div class="overlay">
    <div class="marker marker1" data-count="38" data-continent="North American"></div>
    <div class="marker marker2" data-count="13" data-continent="South American"></div>
    <div class="marker marker3" data-count="47" data-continent="European"></div>
    <div class="marker marker4" data-count="48" data-continent="Asian"></div>
    <div class="marker marker5" data-count="55" data-continent="African"></div>
    <div class="marker marker6" data-count="20" data-continent="Oceanian"></div>
  </div>
</div>
              
            
!

CSS

              
                img{
  width: 100%;
}

.container{
  width: 800px;
  margin: 0 auto;
}

body{
  font-family: Sans-serif;
}

.overlay{
  position: absolute;
  height: 100%;
  width: 100%;
  z-index: 1;
  top: 0;
}

.container{
  position: relative;
}

.marker{
  position: absolute;
  width: 30px;
  height: 30px;
  background-color: #2bb03191;
  border-radius: 50%;
  color: #fff;
  box-shadow: 0px 0px 0px 7px #2bb0312e;
  transition: all ease 2s;
  transition-delay: 3s;
}

.marker.active{
  animation: pulse 1s ease forwards;
}

.marker:after{
  content: attr(data-count);
  width: 100%;
  text-align: center;
  display: block;
  font-size: 16px;line-height: 30px;
}

.marker1{
  left: 20%;
  top: 40%;
}

.marker2{
  left: 36%;
  top: 75%;
}

.marker3{
  left: 47%;
  top: 35%;
}

.marker4{
  left: 65%;
  top: 33%;
}

.marker5{
  left: 55%;
  top: 70%;
}

.marker6{
  left: 77%;
  top: 78%;
}

.tooltip{
  position: relative;
  width: 120px;
  padding: 0.5rem 1.5rem;
  display: inline-block;
  text-align: center;
  color: #05006d;
  box-shadow: 1px 3px 10px 2px rgba(0,0,0,0.05);
  border-radius: 50px;  font-size: 14px;
  background-color: #fff;
  transform: translate(-1900px, 210px);
  transition: transform 1s ease;
  will-change: transform;
  z-index: 20;
}

.tooltip:after{
  content: '\25B2';
  color: #fff;
  width: 0;
  height: 0;
  top: -15px;
  left: 45%;
  font-size: 1.2rem;
  text-shadow: 0px -3px 10px rgba(0,0,0,0.05);
  display: block;
  position: absolute;
}

@keyframes pulse{
  50%{
     box-shadow: 0px 0px 0px 21px #2bb03100;
}
  68.9%{
     box-shadow: 0px 0px 0px 21px #2bb03100;
  }
  
  69%{
     box-shadow: 0px 0px 0px 0px #2bb0312e;
  }
  100%{
    box-shadow: 0px 0px 0px 7px #2bb0312e;
  }
}
              
            
!

JS

              
                
let tooltip =  document.querySelector('.tooltip');
setInterval(function(){
let rand = Math.floor(Math.random() * (6 - 1 + 1)) + 1;
  let el = document.querySelector('.marker' + rand);
  let active = document.querySelector('.active');
  active && active.classList.remove('active');
  el.classList.add('active');
  let pos = el.getBoundingClientRect();
  tooltip.style.transform='translate('+(pos.x - 75 + window.scrollX)+'px,'+(pos.y + 30 + window.scrollY)+'px';
  let text = el.getAttribute('data-continent') + '<br> Countries';
  setTimeout(function(){
    tooltip.innerHTML = text;
  }, 200)
}, 3000)
              
            
!
999px

Console