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

              
                <section id="takes-west-coast">
    <div class="row editorial-wrapper about-bg-image-02 v-center">
      <div class="col-md-1 col-sm-1 col-xs-1">
        <div class="accent-line wow fadeInDown"></div>
      </div>
      <div class="col-md-6 col-sm-7 col-xs-9">
        <div class="editorial-title wow fadeInDown">
          <p>Hotspots on CSS background</p>
        </div>
        <div class="editorial-description wow fadeInDown">
          <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus scelerisque nunc eget risus placerat mattis. Sed finibus ipsum non nibh accumsan, quis pellentesque neque ultricies. Etiam non tellus massa. Curabitur faucibus luctus elit non euismod. Vestibulum et velit at elit eleifend ultrices. Vestibulum dictum efficitur nisl eu fringilla.
          </p>
        </div>
      </div>
    </div>
    <div class="hotspots-wrapper">
      <div class="radars-location">
        <div class="hotspots hs-lv">
          <div class="pulsar">
            <div class="ring ring-1"></div>
          </div>
        </div>
        <div class="hotspots hs-la">
          <div class="pulsar">
            <div class="ring ring-2"></div>
          </div>
        </div>
        <div class="hotspots hs-sj">
          <div class="pulsar">
            <div class="ring ring-3"></div>
          </div>
        </div>
      </div>
    </div>
  </section>
              
            
!

CSS

              
                @import "bourbon";

/* Editorial  */
.editorial-wrapper{
  padding-top: 50px;
  padding-bottom: 50px; 
  .accent-line {
    width: 100%;
    height: 60px;
    border-bottom-width: 1px;
    border-style: solid;
    border-top: none;
    border-left: none;
    border-right: none;
    display: inline-block;
    float: left;
  }
  .editorial-title {
    font-size: 30px;
    padding-top: 30px;
    padding-bottom: 10px;
    font-weight: 100;
    letter-spacing: 3px;
    text-transform: uppercase;
    display: inline-block;
    float: left;
    line-height: 40px;
  }
  .editorial-title p {
    font-weight: 400;
    padding-top: 10px;
    font-size: 45px;
  }
  .editorial-description {
    width: 100%;
    padding-right: 10%;
    display: inline;
    float: left;
    p{
      font-size: 18px;
    }
  }
}

/* Map and Hotspots */
$bg-image-height: 700px;

section#takes-west-coast{
  .about-bg-image-02{
    height: $bg-image-height;
    background-image: url('http://joekang.co/assets/image-hosting/hero-about-02.jpg');
    background-repeat: no-repeat;
    background-position: center 72%;
    background-size: cover;
    color: #fff;
    position: absolute;
  }
  .hotspots-wrapper{
    position: relative;
    height: $bg-image-height;
    
    .radars-location{
      max-width: none;
      max-height: none;
      width: 100%;
      height: $bg-image-height;
      position: relative;
      .hotspots{
        position: absolute;
        top: 50%;
        left: 50%;
        .pulsar {
         /* width: 200px;
          height: 200px;*/
          margin: 0px auto;
          position: relative;
        }
        
        $number: 3;
        $width: 40px;
        $hsl:160;
                
        @mixin shadow($b,$s,$sm,$c){
          box-shadow:
              0 0 8px 6px $c,
              /*0 0 $b $s white,*/
              0 0 $b ($s + $sm) $c;
        }
        .ring{
            width: $width;
            height: $width;
            opacity: 0.8;
            border-radius: 50%;
            @include transition(all .2s);
        }   

        @for $i from 0 to $number {
          $c:hsl($hsl,100%,55%);
          $c2:hsl((6*$i),100%,55%);

          .ring-#{$i+1}{          
            background: lighten($c,5%); 
            @include animation(r+$i 2s ($i/4)+s ease-out infinite);         
          }
          @include keyframes(r+$i) {
            0%{@include shadow(0px,0px,0px,rgba($c,0));}
            10%{@include shadow(2px,10px,0px,$c);}
            100%{@include shadow(20px,50px,10px,rgba($c,0));}
          }
          @include keyframes(r2+$i) {
            from{@include shadow(12px,10px,4px,$c2);}
            to{@include shadow(4px,40px,1px,rgba($c2,0));}
          }
        }
      }
    }
  }
}
              
            
!

JS

              
                var imageWidth = 2000,
    imageHeight = 700,
    imageAspectRatio = imageWidth / imageHeight,
    $window = $(window); 

var hotSpots = [{
  'city': 'las vegas',
  'x': 595,
  'y': 14
}, {
  'city': 'los angeles',
  'x': 350,
  'y': 70
}, {
  'city': 'san jose',
  'x': 127,
  'y': -70
}];

function appendHotSpots() {
  for (var i = 0; i < hotSpots.length; i++) {
    var $hotSpot = $('.radars-location').hasClass('hotspots');
//     $('.container').append($hotSpot);
  }
  positionHotSpots();
}

function positionHotSpots() {
  var windowWidth = $window.width(),
//     windowHeight = $window.height(),
      windowHeight = 700,
    windowAspectRatio = windowWidth / windowHeight,
    $hotSpot = $('.hotspots');

  $hotSpot.each(function(index) {
    var xPos = hotSpots[index]['x'],
        yPos = hotSpots[index]['y'],
        desiredLeft = 0,
        desiredTop = 0;

    if (windowAspectRatio > imageAspectRatio) {
      yPos = (yPos / imageHeight) * 100;
      xPos = (xPos / imageWidth) * 100;
    } else {
      yPos = ((yPos / (windowAspectRatio / imageAspectRatio)) / imageHeight) * 100;
      xPos = ((xPos / (windowAspectRatio / imageAspectRatio)) / imageWidth) * 100;
    }

    $(this).css({
      'margin-top': yPos + '%',
      'margin-left': xPos + '%'
    });

  });
}

appendHotSpots();

$(window).resize(positionHotSpots);

              
            
!
999px

Console