Web Design Guide 2024-10-28 08:44:01 | 2.0.0
<div class="image-map">
    <div class="image-map__wrapper">
        <div class=" media ">
            <img class="media__item" src="/demo/teaser/teaser6.jpg" alt=>
        </div>

        <map class="image-map__areas">
            <area shape="rect" coords="0,0,0,0" href="#" class="image-map__area" />
            <div class="image-map__hotzone image-map__hotzone--text">
                <div class="overlay overlay--theme-dark-on-light">
                    <a href="#">
                        <div class="overlay__item overlay__item--title">More</div>
                    </a>
                </div>
            </div>
            <area shape="rect" coords="0,0,0,0" href="#" class="image-map__area" />
            <a href="#" class="image-map__hotzone image-map__hotzone--icon"></a>
        </map>

        <div class="image-map__cta">
            <a href="#" class="image-map__link btn -cta">More</a>
        </div>
    </div>

    <div class="image-map__quick-info quick-info -activee quick-info--image-map">
        <button class="quick-info__close"></button>
        <div class="quick-info__visual">
            <a href="#" class="quick-info__image-link">
                <div class=" media ">
                    <img class="media__item" src="/demo/1000x1000.png" alt=Imaginary image>
                </div>
            </a>
        </div>
        <div class="quick-info__content">
            <div class="quick-info__headline"><span class="h3">Title</span></div>
            <div class="quick-info__text">The groundbreaking ChefWave™ HD is the world&#x27;s first high pressure microwave deep fryer.</div>
            <a class="quick-info__cta btn -cta" href="#">More</a>
        </div>
    </div>

</div>
<div class="image-map">
  <div class="image-map__wrapper">
    {{render '@atoms-media--image' image}}

    <map class="image-map__areas">
      {{#each imageMapAreas}}
        <area shape="rect" coords="0,0,0,0" href="#" class="image-map__area" />
        {{#if inline}}
          <div class="image-map__hotzone image-map__hotzone--text">
            <div class="overlay overlay--theme-dark-on-light">
              <a href="#">
                <div class="overlay__item overlay__item--title">{{title}}</div>
              </a>
            </div>
          </div>
        {{else}}
          <a href="#" class="image-map__hotzone image-map__hotzone--icon"></a>
        {{/if}}
      {{/each}}
    </map>

    {{#if cta}}
      <div class="image-map__cta">
        <a href="{{{cta.link}}}" class="image-map__link btn -cta">{{cta.label}}</a>
      </div>
    {{/if}}
  </div>

  {{render '@molecules-quick-info' quickInfo merge=true}}
</div>
{
  "quickInfo": {
    "mixes": "image-map__quick-info",
    "modifiers": "-activee quick-info--image-map"
  },
  "image": {
    "src": "/demo/teaser/teaser6.jpg"
  },
  "cta": {
    "link": "#",
    "label": "More"
  },
  "imageMapAreas": [
    {
      "inline": true,
      "title": "More"
    },
    {
      "inline": null
    }
  ]
}
  • Content:
    $imagemap-prefix: 'image-map' !default;
    $imagemap-quickinfo-as-overlay: true !default;
    $imagemap-hotzone-icon-size: 20px !default;
    $imagemap-hotzone-icon-after-size: $imagemap-hotzone-icon-size * 1.4;
    $imagemap-hotzone-icon-after-position: -6px !default;
    $imagemap-overlay-prefix: 'overlay' !default;
    $imagemap-overlay-color-dark: $black !default;
    $imagemap-overlay-color-light: $white !default;
    
    @keyframes pulse-hotzone-after {
      0% {
        transform: scale(1);
      }
    
      40% {
        transform: scale(1.1);
      }
    
      100% {
        transform: scale(1);
      }
    }
    
    @keyframes pulse-hotzone-before {
      0% {
        transform: scale(1);
      }
    
      40% {
        transform: scale(0.8);
      }
    
      100% {
        transform: scale(1);
      }
    }
    
    .#{$imagemap-prefix} {
      position: relative;
    
      &__wrapper {
        position: relative;
        overflow: hidden;
      }
    
      &__image {
        user-select: none;
      }
    
      &__hotzone {
        position: absolute;
        z-index: 100;
        display: block;
        padding: 0;
        transform: translate(-50%, -50%);
        border: 0;
    
        &--text p {
          margin: 0;
          padding: 0;
        }
    
        &--icon {
          height: $imagemap-hotzone-icon-size;
          padding-right: 1em;
          border: 2px solid $white;
          border-radius: 50%;
          background-color: $primary;
          font-size: ($imagemap-hotzone-icon-size - 4px);
          transition: background-color 0.25s, border-color 0.25s;
          cursor: pointer;
    
          &::after,
          &::before {
            content: '';
            position: absolute;
            top: $imagemap-hotzone-icon-after-position;
            left: $imagemap-hotzone-icon-after-position;
            display: block;
            width: $imagemap-hotzone-icon-after-size;
            height: $imagemap-hotzone-icon-after-size;
            border: 2px solid $white;
            border-radius: 50%;
          }
    
          &::after {
            border-width: 1px;
          }
    
          > i {
            display: block;
          }
        }
    
        &:hover.#{$imagemap-prefix}__hotzone--icon {
          // border-color: $primary;
          // background-color: $white;
    
          &::before {
            animation: pulse-hotzone-before;
            animation-duration: 1.5s;
            animation-iteration-count: infinite;
          }
    
          &::after {
            animation: pulse-hotzone-after;
            animation-duration: 1.5s;
            animation-iteration-count: infinite;
          }
        }
    
        &--active.#{$imagemap-prefix}__hotzone--icon {
          border-color: $primary;
        }
      }
    
      &__cta {
        position: absolute;
        right: 0;
        bottom: 2 * $base-margin;
        left: 0;
        display: flex;
        justify-content: center;
      }
    
      &__quick-info {
        position: absolute;
        z-index: 120;
    
        @include breakpoint(pre-large down) {
          display: flex;
          flex-direction: column;
          justify-content: flex-end;
          background-color: $white;
        }
    
        @each $breakpoint, $gutter in $grid-gutters {
          @include breakpoint($breakpoint) {
            top: rem-calc($gutter);
            right: rem-calc($gutter);
            bottom: rem-calc($gutter);
            left: rem-calc($gutter);
          }
        }
    
        @include breakpoint(medium) {
          top: 50%;
          right: auto;
          bottom: auto;
          left: 50%;
          width: $container-max-width / 2;
          max-width: $container-max-width / 2;
          height: auto;
          transform: translate(-50%, -50%);
        }
    
        .quick-info__visual + .quick-info__content {
          @include breakpoint(pre-large down) {
            position: absolute;
            right: 0;
            bottom: 0;
            left: 0;
            background: linear-gradient(to top, rgba(255, 255, 255, 0.9) 0, $transparent 18rem) no-repeat;
          }
        }
      }
    }
    
    /**
     * Text-Overlay (part of ImageMap feature)
     */
    .#{$imagemap-overlay-prefix} {
      &--theme-dark,
      &--theme-light,
      &--theme-light-on-dark,
      &--theme-dark-on-light {
        @each $breakpoint, $gutter in $grid-gutters {
          @include breakpoint($breakpoint) {
            padding: rem-calc($gutter / 2);
          }
        }
    
        > a {
          text-decoration: none;
        }
      }
    
      &--theme-dark {
        background-color: $transparent;
    
        > a {
          color: $imagemap-overlay-color-dark;
        }
      }
    
      &--theme-light {
        background-color: $transparent;
    
        > a {
          color: $imagemap-overlay-color-light;
        }
      }
    
      &--theme-light-on-dark {
        background-color: $black;
    
        > a {
          color: $imagemap-overlay-color-light;
        }
      }
    
      &--theme-dark-on-light {
        background-color: $white;
    
        > a {
          color: $imagemap-overlay-color-dark;
        }
      }
    }
    
    // stylelint-disable-next-line selector-no-qualifying-type
    body.modal .scroller {
      // stylelint-disable-next-line declaration-no-important
      display: none !important;
    }
    
  • URL: /components/raw/molecules-image-map/_image-map.scss
  • Filesystem Path: src/components/02-ui-components/02-molecules/17-image-map/_image-map.scss
  • Size: 4.6 KB

There are no notes for this item.