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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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="tabs">
    <ul class="tab-labels">
      <li class="tab-label tab--active">Interior</li>
      <li class="tab-label">Exterior</li>
    </ul>
    <ul class="tab-contents">
      <li class="tab-content tab--active">
        <div class="hotspots warp" data-warp="2000">
          <div class="hotspot-photo warp-item" style="background-image: url('https://www.eyerevolution.co.uk/wp-content/uploads/2017/01/CarShoots.jpg')"></div>

          <div class="drawer">
            <a href="#" class="drawer-trigger hotspot" style="left: 37%; top: 33%"></a>
            <div class="drawer-content">
              <div class="drawer-close"></div>
              <div class="drawer-image" style="background-image: url('http://www.ultimateautomotive.ca/Images/heated_seats.jpg')"></div>
              <div class="drawer-inner">
                <h3 class="drawer-heading">Lorem Ipsum Dolor Sit</h3>
                <p class="drawer-text">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Magni quod necessitatibus natus aperiam culpa ea, illo cupiditate incidunt? Aspernatur natus nam dolores porro enim voluptate cupiditate qui obcaecati rem quis!</p>
              </div>
            </div>
          </div>

          <div class="drawer">
            <a href="#" class="drawer-trigger hotspot" style="left: 66%; top: 50%"></a>
            <div class="drawer-content">
              <div class="drawer-close"></div>
              <div class="drawer-image" style="background-image: url('http://www.ultimateautomotive.ca/Images/heated_seats.jpg')"></div>
              <div class="drawer-inner">
                <h3 class="drawer-heading">Lorem Ipsum Dolor Sit</h3>
                <p class="drawer-text">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Magni quod necessitatibus natus aperiam culpa ea, illo cupiditate incidunt? Aspernatur natus nam dolores porro enim voluptate cupiditate qui obcaecati rem quis!</p>
              </div>
            </div>
          </div>

          <div class="drawer">
            <a href="#" class="drawer-trigger hotspot" style="left: 80%; top: 10%"></a>
            <div class="drawer-content">
              <div class="drawer-close"></div>
              <div class="drawer-image" style="background-image: url('http://www.ultimateautomotive.ca/Images/heated_seats.jpg')"></div>
              <div class="drawer-inner">
                <h3 class="drawer-heading">Lorem Ipsum Dolor Sit</h3>
                <p class="drawer-text">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Magni quod necessitatibus natus aperiam culpa ea, illo cupiditate incidunt? Aspernatur natus nam dolores porro enim voluptate cupiditate qui obcaecati rem quis!</p>
              </div>
            </div>
          </div>

        </div>
      </li>

      <li class="tab-content">
        <div class="hotspots">
          <div class="hotspot-photo" style="background-image: url('https://bangshift.com/wp-content/uploads/2014/09/model_s.jpeg')"></div>

          <div class="drawer">
            <a href="#" class="drawer-trigger hotspot" style="left: 15%; top: 77%"></a>
            <div class="drawer-content">
              <div class="drawer-close"></div>
              <div class="drawer-image" style="background-image: url('http://www.ultimateautomotive.ca/Images/heated_seats.jpg')"></div>
              <div class="drawer-inner">
                <h3 class="drawer-heading">Lorem Ipsum Dolor Sit</h3>
                <p class="drawer-text">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Magni quod necessitatibus natus aperiam culpa ea, illo cupiditate incidunt? Aspernatur natus nam dolores porro enim voluptate cupiditate qui obcaecati rem quis!</p>
              </div>
            </div>
          </div>

          <div class="drawer">
            <a href="#" class="drawer-trigger hotspot" style="left: 33%; top: 49%"></a>
            <div class="drawer-content">
              <div class="drawer-close"></div>
              <div class="drawer-image" style="background-image: url('http://www.ultimateautomotive.ca/Images/heated_seats.jpg')"></div>
              <div class="drawer-inner">
                <h3 class="drawer-heading">Lorem Ipsum Dolor Sit</h3>
                <p class="drawer-text">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Magni quod necessitatibus natus aperiam culpa ea, illo cupiditate incidunt? Aspernatur natus nam dolores porro enim voluptate cupiditate qui obcaecati rem quis!</p>
              </div>
            </div>
          </div>

          <div class="drawer">
            <a href="#" class="drawer-trigger hotspot" style="left: 60%; top: 38%"></a>
            <div class="drawer-content">
              <div class="drawer-close"></div>
              <div class="drawer-image" style="background-image: url('http://www.ultimateautomotive.ca/Images/heated_seats.jpg')"></div>
              <div class="drawer-inner">
                <h3 class="drawer-heading">Lorem Ipsum Dolor Sit</h3>
                <p class="drawer-text">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Magni quod necessitatibus natus aperiam culpa ea, illo cupiditate incidunt? Aspernatur natus nam dolores porro enim voluptate cupiditate qui obcaecati rem quis!</p>
              </div>
            </div>
          </div>

          <div class="drawer">
            <a href="#" class="drawer-trigger hotspot" style="left: 63%; top: 67%"></a>
            <div class="drawer-content">
              <div class="drawer-close"></div>
              <div class="drawer-image" style="background-image: url('http://www.ultimateautomotive.ca/Images/heated_seats.jpg')"></div>
              <div class="drawer-inner">
                <h3 class="drawer-heading">Lorem Ipsum Dolor Sit</h3>
                <p class="drawer-text">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Magni quod necessitatibus natus aperiam culpa ea, illo cupiditate incidunt? Aspernatur natus nam dolores porro enim voluptate cupiditate qui obcaecati rem quis!</p>
              </div>
            </div>
          </div>

        </div>
      </li>
    </ul>
  </div>

  <div class="card-wrapper">
    <div class="warp">
      <div class="card warp-item">
        <div class="card-image"></div>
        <div class="card-content">
          <h3>Card Title</h3>
          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Libero quia hic repellat voluptates molestias dicta adipisci tempore labore! Doloribus aliquam, perspiciatis sapiente ratione fugit minus corporis est saepe atque culpa.</p>
        </div>
      </div>
    </div>
  </div>

</div>
              
            
!

CSS

              
                // ----------------------------
// Global Styles
// ----------------------------
*, *:before, *:after {
  box-sizing: border-box;
}

body {
  padding: 0;
  margin: 0;
  margin-top: 20px;
  font-family: sans-serif;
}

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

// ----------------------------
// Warp Effect
// ----------------------------
.warp {
  display: inline-block;
}

.warp-item {
  -webkit-filter: blur(0);
  transition: transform 0.1s linear;
}

// ----------------------------
// Card
// ----------------------------
.card-wrapper {
  margin: 60px;
}

.card {
  width: 300px;
  border: 1px solid #ccc;
  transition: all 0.1s ease-in-out;
  &:hover {
    box-shadow: 0px 0px 15px rgba(black, 0.15);
  }
}

.card-image {
  height: 150px;
  background: #ccc;
}

.card-content {
  padding: 10px;
  h3 {
    margin: 0;
    margin-bottom: 5px;
  }
  p {
    margin: 0;
    font-size: 12px;
  }
}
// ----------------------------
// Tabs
// ----------------------------
.tab-labels, .tab-contents {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

.tab-labels {
  margin-left: 16px;
  margin-bottom: 16px;
}

.tab-label {
  cursor: pointer;
  display: inline-block;
  padding: 10px;
  color: #7f7f7f;
  transition: all 0.2s ease-in-out;
  position: relative;
  &:hover {
    color: black;
  }
  &:before {
    content: '';
    position: absolute;
    display: block;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    opacity: 0;
    background: black;
    transition: all 0.2s ease-in-out;
  }
  &.tab--active {
    color: black;
    &:before {
      opacity: 1;
      width: 100%;
      left: 0;
    }
  }
}

.tab-content {
  display: none;
  &.tab--active {
    display: block;
  }
}

// ----------------------------
// Hotspots
// ----------------------------
$hotspot: #BB0A30;
$hotspotOffset: -30px;

.hotspots {
  position: relative;
  overflow: hidden;
  display: block;
  &:before {
    display: block;
    padding-top: 50%;
    content: '';
  }
}

.hotspot-photo {
  background-color: #ccc;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  position: absolute;
  top: $hotspotOffset;
  left: $hotspotOffset;
  right: $hotspotOffset;
  bottom: $hotspotOffset;
  transform-origin: center center;
}

.hotspot {
  position: absolute;
  text-align: center;
  text-decoration: none;
  top: 0;
  left: 0;
  padding-top: 2px;
  width: 25px;
  height: 25px;
  background-color: $hotspot;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 14px;
  background-image: url('data:image/svg+xml;utf8,<svg version="1.1" viewBox="0 0 11 11" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(-1176 -2262)" fill="none" fill-rule="evenodd"> <g transform="translate(0 1781)" fill="#fff" fill-rule="nonzero"> <g transform="translate(0 60)"> <g transform="translate(1160 405)"> <g transform="translate(16 16)"> <path d="m5.5 0c-0.14425 0-0.2619 0.11765-0.2619 0.2619v4.9762h-4.9762c-0.14425 0-0.2619 0.11765-0.2619 0.2619s0.11765 0.2619 0.2619 0.2619h4.9762v4.9762c0 0.14425 0.11765 0.2619 0.2619 0.2619s0.2619-0.11765 0.2619-0.2619v-4.9762h4.9762c0.14425 0 0.2619-0.11765 0.2619-0.2619s-0.11765-0.2619-0.2619-0.2619h-4.9762v-4.9762c0-0.14425-0.11765-0.2619-0.2619-0.2619z"/> </g> </g> </g> </g> </g> </svg>');
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: 
    box-shadow 0.2s ease-in-out,
    background 0.2s ease-in-out;
  box-shadow:
    0 0 3px rgba(black, 0.8),
    0 0 0 4px rgba($hotspot, 0.3),
    0 0 0 8px rgba($hotspot, 0.2),
    0 0 20px 10px rgba($hotspot, 0.2);
  &:hover {
    background-color: lighten($hotspot, 10);
    box-shadow:
      0 0 5px rgba(black, 0.8),
      0 0 0 6px rgba($hotspot, 0.3),
      0 0 0 10px rgba($hotspot, 0.2),
      0 0 20px 10px rgba($hotspot, 0.2);
  }
}

// ----------------------------
// Drawer
// ----------------------------
.drawer-content {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 50%;
  background: black;
  color: white;
  z-index: 2;
  padding: 20px;
  transform: translatex(100%);
}

.drawer-image {
  position: absolute;
  top: 0;
  left: 0;
  height: 50%;
  width: 100%;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}

.drawer-inner {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 50%;
  overflow: auto;
  padding: 30px;
}

.drawer-close {
  position: absolute;
  top: calc(50% - 20px);
  left: -20px;
  width: 40px;
  height: 40px;
  opacity: 0;
  cursor: pointer;
  transform: rotate(-180deg) translateX(20px);
  background-color: white;
  background-image: url('data:image/svg+xml;utf8,<svg version="1.1" viewBox="0 0 28 17" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(-696 -2197)" fill="none" fill-rule="evenodd"> <g transform="translate(0 1781)" fill="black" fill-rule="nonzero" stroke="#fff" stroke-width=".25"> <g transform="translate(685 60)"> <g transform="translate(25 365) translate(-25 -25)"> <g transform="translate(12 17)"> <path d="m0.67998 8.3149h23.486l-5.9151 5.7865c-0.26562 0.25984-0.26562 0.6808 0 0.94062 0.13281 0.12992 0.30679 0.19488 0.48078 0.19488 0.17399 0 0.34794-0.06496 0.48078-0.19488l7.1078-6.9533c0.26562-0.25984 0.26562-0.6808 0-0.94062l-7.1078-6.9533c-0.26562-0.25984-0.69592-0.25984-0.96152 0-0.2656 0.25984-0.26562 0.6808 0 0.94062l5.979 5.8491h-23.55c-0.37586 0-0.67998 0.29752-0.67998 0.6652-3.3999e-5 0.36765 0.3041 0.66516 0.67994 0.66516z"/> </g> </g> </g> </g> </g> </svg>');
  background-repeat: no-repeat;
  background-size: 20px;
  background-position: center center;
  border-radius: 50%;
  z-index: 1;
  transition: background-color 0.2s ease-in-out;
  &:hover {
    background-color: $hotspot;
    background-image: url('data:image/svg+xml;utf8,<svg version="1.1" viewBox="0 0 28 17" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(-696 -2197)" fill="none" fill-rule="evenodd"> <g transform="translate(0 1781)" fill="#fff" fill-rule="nonzero" stroke="#fff" stroke-width=".25"> <g transform="translate(685 60)"> <g transform="translate(25 365) translate(-25 -25)"> <g transform="translate(12 17)"> <path d="m0.67998 8.3149h23.486l-5.9151 5.7865c-0.26562 0.25984-0.26562 0.6808 0 0.94062 0.13281 0.12992 0.30679 0.19488 0.48078 0.19488 0.17399 0 0.34794-0.06496 0.48078-0.19488l7.1078-6.9533c0.26562-0.25984 0.26562-0.6808 0-0.94062l-7.1078-6.9533c-0.26562-0.25984-0.69592-0.25984-0.96152 0-0.2656 0.25984-0.26562 0.6808 0 0.94062l5.979 5.8491h-23.55c-0.37586 0-0.67998 0.29752-0.67998 0.6652-3.3999e-5 0.36765 0.3041 0.66516 0.67994 0.66516z"/> </g> </g> </g> </g> </g> </svg>
');
  }
}

.drawer-heading {
  margin: 0;
  margin-bottom: 16px;
}

.drawer-text {
  color: #8b8b8b;
  font-size: 13px;
  line-height: 20px;
}
              
            
!

JS

              
                $(document).ready(function () {
  initHotspots()
  initTabs()
  initWarps()
  initDrawers()
})

// ----------------------------
// Hotspots
// ----------------------------
function initHotspots () {
  animateHotspots($('.tab--active .hotspot'))
  
  // Hotspots drawer
  $('.hotspot').click(function () {
    $('.hotspot-drawer--open').removeClass('hotspot-drawer--open')
    $(this).next().addClass('hotspot-drawer--open')
  })
  
  $('.hotspot-drawer').click(function () {
    $('.hotspot-drawer--open').removeClass('hotspot-drawer--open')
  })
}

function animateHotspots (elem) {
  var tl = new TimelineMax(); 
  tl.staggerFrom(elem, 0.5, { 
    css: {
     opacity: 0,
     scale: 0,
     rotation: 180
    },
    ease: Back.easeOut.config(3)
  }, 0.2)
  tl.pause(0, true)
  tl.play()
}

// ----------------------------
// Tabs
// ----------------------------
function initTabs () {
  $('.tab-label').click(function (e) {
    var index = $(this).index()
    var tabs = $(this).closest('.tabs')
    tabs.find('.tab--active').removeClass('tab--active')
    $(this).addClass('tab--active')
    tabs.find('.tab-content:eq(' + index + ')').addClass('tab--active')
    animateHotspots($('.tab--active .hotspot'))
  })
}

// ----------------------------
// Drawers
// ----------------------------
function initDrawers () {
  $('.drawer-trigger').click(function () {
    var drawer = $(this).closest('.drawer')
    if (!drawer.hasClass('drawer--active')) {
      if ($('.drawer--active').length) {
        drawerOut($('.drawer--active'))
      }
      drawerIn(drawer) 
    }
  })
  
  $('.drawer-close').click(function () {
    var drawer = $(this).closest('.drawer')
    drawerOut(drawer)
  })
}

function drawerIn (drawer) {
  drawer.addClass('drawer--active')
    var tl = new TimelineMax();
    tl
      .to(drawer.find('.drawer-content'), 0.2, { x: '0%' })
      .from(drawer.find('.drawer-image'), 0.2, { opacity: 0 })
      .from(drawer.find('.drawer-inner'), 0.2, {
        opacity: 0,
        y: -20
      })
      .to(drawer.find('.drawer-close'), 0.2, {
        x: 0,
        opacity: 1,
        rotation: 0
      })
      .play()
}

function drawerOut (drawer) {
  drawer.removeClass('drawer--active')
    var tl = new TimelineMax(); 
    tl
     .to(drawer.find('.drawer-close'), 0.2, {
       x: -20,
       opacity: 0,
       rotation: -180
     })
     .to(drawer.find('.drawer-content'), 0.2, { x: '100%' })
     .play()
}

// ----------------------------
// Warps
// ----------------------------
function initWarps () {
  $('.warp')
    .each(function () {
      var warpAmount = $(this).data('warp') || 1000
      $(this).css('perspective', warpAmount + 'px')
    })
    .mousemove(function (e) {
      var warp = $(e.target)
      if (!warp.hasClass('warp')) warp = warp.closest('.warp')
      var warpItem = warp.find('.warp-item')
      var mouseX = e.pageX - warp[0].offsetLeft;
      var mouseY = e.pageY - warp[0].offsetTop;
      var width = warp.outerWidth()
      var height = warp.outerHeight()
      var centerX = width / 2
      var centerY = height / 2
      var rotateX = (centerX - mouseX) / width * 200
      var rotateY = (centerY - mouseY) / height * 200
      rotateX = Math.round(rotateX * 0.1)
      rotateY = Math.round(rotateY * 0.1)
      warpItem.css('transform', `rotateY(${rotateX}deg) rotateX(${rotateY}deg)`)
    })
    .mouseleave(function (e) {
      var warp = $(e.target)
      if (!warp.hasClass('warp')) warp = warp.closest('.warp')
      var warpItem = warp.find('.warp-item')
      warpItem.css('transform', 'rotateY(0deg) rotateX(0deg)')
    })
}
              
            
!
999px

Console