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

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='container'>
  <div class='buttons'>
    <div class='btn' data-anim='pulse'> Shrink/Grow </div>
    <div class='btn' data-anim='wobble'> Wobble </div>
    <div class='btn' data-anim='flicker'> Flicker </div>
  </div>
  <div id="map"></div>
</div>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>

              
            
!

CSS

              
                .container{
  height:500px;
  width:100%;
  position: relative;
}

.buttons{
  position:absolute;
  top:4px;
  right: 8px;
  z-index:100;
}

.btn{
  display:inline-block;
  padding: 4px 8px;
  background-color:#ccc;
  border-radius:2px;
  float:left;
  border:1px solid #999;
  font-size:16px;
  cursor:pointer;
}

.btn:hover{
  background-color:#999;
  transition: 250ms;
}

#map{
  height:100%;
  width:100%;
}

/* This is where you plug in the CSS for marker animations */
#markerLayer img {
  animation: pulse .5s infinite alternate;
	-webkit-animation: pulse .5s infinite alternate;
	transform-origin: center;
	-webkit-transform-origin: center;
}


/* Animaitons */
keyframes pulse{
	to { 
		transform: scale(0.7);
		-webkit-transform: scale(0.7);  
	}
}

@-webkit-keyframes pulse{
	to { 
		transform: scale(0.7);
		-webkit-transform: scale(0.7);  
	}
}

@-webkit-keyframes wobble {
  from {
    -webkit-transform: none;
    transform: none;
  }

  15% {
    -webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
    transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
  }

  30% {
    -webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
    transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
  }

  45% {
    -webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
    transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
  }

  60% {
    -webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
    transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
  }

  75% {
    -webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
    transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
  }

  to {
    -webkit-transform: none;
    transform: none;
  }
}

@keyframes wobble {
  from {
    -webkit-transform: none;
    transform: none;
  }

  15% {
    -webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
    transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
  }

  30% {
    -webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
    transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
  }

  45% {
    -webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
    transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
  }

  60% {
    -webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
    transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
  }

  75% {
    -webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
    transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
  }

  to {
    -webkit-transform: none;
    transform: none;
  }
}

@-webkit-keyframes flicker {
  from, 50%, to {
    opacity: 1;
  }

  25%, 75% {
    opacity: 0;
  }
}

@keyframes flicker {
  from, 50%, to {
    opacity: 1;
  }

  25%, 75% {
    opacity: 0;
  }
}

body {margin: 0; padding: 0;}
              
            
!

JS

              
                $(document).ready(function(){
  
  var map;
  var markerArr=[];

  function initialize() {
    var mapOptions = {
      zoom: 9,
      mapTypeControl: false,
      center: new google.maps.LatLng(42.36, -71.06)
    };
    map = new google.maps.Map(document.getElementById('map'), mapOptions);

    // image from external URL
    var myIcon ='https://s3-us-west-2.amazonaws.com/s.cdpn.io/123941/cheshire1-icon.png';
    
    //preparing the image so it can be used as a marker
    //https://developers.google.com/maps/documentation/javascript/reference#Icon
    //includes hacky fix "size" to allow for wobble
    var catIcon = {
      url: myIcon,
      size: new google.maps.Size(100, 60),
      scaledSize: new google.maps.Size(70, 60),
      origin: new google.maps.Point(-15,0)
    }
    
    /*
    //If you want to do this without wobble animation no need for hacky fix
    var catIcon = {
      url: myIcon,
      size: new google.maps.Size(70, 60),
      scaledSize: new google.maps.Size(70, 60),
      origin: new google.maps.Point(0,0)
    }*/
    
    //gets GeoJSON from external file
    $.getJSON( "https://codepen.io/kevinkononenko/pen/dMKzgG.js", function(data) {
        var length= data.features.length
        for (var i=0; i < length; i++){
          var eachData = data.features[i].properties
          var latLng = new google.maps.LatLng(eachData.Latitude, eachData.Longitude);
          var marker = new google.maps.Marker({
              position:latLng,
              map: map,
              // set the icon as catIcon declared above
              icon: catIcon,
              // must use optimized false for CSS
              optimized: false,
              title: markerArr.length.toString()
          });
          markerArr.push(marker);
          
          //add a click handler that does nothing at the moment
          google.maps.event.addListener(marker, 'click', function() {
            var thisTitle= Number(this.title);
            //$('#markerLayer img').eq(thisTitle)
          })
          
        }
      });  
    
       // Overlay view allows you to organize your markers in the DOM
        // https://developers.google.com/maps/documentation/javascript/reference#OverlayView
       var myoverlay = new google.maps.OverlayView();
       myoverlay.draw = function () {
           // add an id to the layer that includes all the markers so you can use it in CSS
           this.getPanes().markerLayer.id='markerLayer';
       };
       myoverlay.setMap(map);
        
  }

  initialize();
  
  
  // use jQuery to change the markers animation based on toggle button
  $('.btn').click(function(){
    var type = $(this).data('anim');
    $('#markerLayer img').css('animation', type+ ' 1s infinite alternate');
    $('#markerLayer img').css('-webkit-animation', type+ ' 1s infinite alternate')
  })
  
});


              
            
!
999px

Console