Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <ul class="context">
    <li class="context__header">Поделиться</li>
    <li class="context__item context__item--twitter"><a href="#"><i class="pre entypo-twitter"> </i>Твитнуть</a></li>
    <li class="context__item context__item--facebook"><a href="#"><i class="pre entypo-facebook-squared"> </i>Зафейсбучить</a></li>
    <li class="context__item context__item--google context__item--nope"><a href="#" title="lol, not likely">Загуглплюсить</a></li>
    <li class="context__item context__item--pinterest"><a href="#"><i class="pre entypo-pinterest"> </i>Пнуть</a></li>
    <li class="context__divider"></li>
    <li class="context__item context__item--email"><a href="#">Рассказать друзьям</a><i class="post entypo-right-open"></i>
        <ul class="context context--sub">
            <li class="context__item"><a href="#">Вася</a></li>
            <li class="context__item"><a href="#"><i class="pre entypo-check"> </i>Петчя</a></li>
            <li class="context__item"><a href="#">Прохор</a></li>
            <li class="context__item"><a href="#">Елизар</a></li>
            <li class="context__item"><a href="#">Афроний</a></li>
        </ul>
    </li>
    <li class="context__item context__item--email"><a href="#">Изобрести велосипед</a></li>
</ul>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Lato:300,300italic,700,700italic);
@import url(http://weloveiconfonts.com/api/?family=entypo);

.context {
  font-size: 14px;
  color: #D0C7FF;
  list-style: none;
  margin: 0;
  padding: 0.05em 0.25em;
  border: 1px solid transparent;
  border-right-color: #5062c2;
  border-bottom-color: #5062c2;
  border-radius: 3px;
  position: absolute;
  min-width: 16em;
  z-index: 1;
  background: -webkit-linear-gradient(305deg, #673AB7, #3F51B5);
  background: linear-gradient(145deg, #673AB7, #3F51B5);
  box-shadow: 0 4px 14px -5px #141321;
  will-change: transform, opacity;
  -webkit-transition: opacity, visibility, -webkit-transform;
  transition: opacity, visibility, -webkit-transform;
  transition: transform, opacity, visibility;
  transition: transform, opacity, visibility, -webkit-transform;
  -webkit-transition-duration: 0.35s, 0.2s, 0s;
          transition-duration: 0.35s, 0.2s, 0s;
  -webkit-transition-delay: 0.08s, 0s, 0.4s;
          transition-delay: 0.08s, 0s, 0.4s;
  -webkit-transition-timing-function: ease;
          transition-timing-function: ease;
  -webkit-transform: rotate3d(-1, -1, 0, 25deg) scale(1);
          transform: rotate3d(-1, -1, 0, 25deg) scale(1);
  -webkit-transform-origin: 0 0;
          transform-origin: 0 0;
  opacity: 0;
  visibility: hidden;
}
.context, .context * {
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
  cursor: default;
}
.context.is-visible {
  opacity: 1;
  -webkit-transform: none;
          transform: none;
  -webkit-transition-delay: 0s, 0s, 0s;
          transition-delay: 0s, 0s, 0s;
  visibility: visible;
}
.context--sub {
  background: #4b4ab6;
  width: auto;
  min-width: 10em;
  left: 100%;
  top: -0.4em;
  -webkit-transform: translateX(-0.7em);
          transform: translateX(-0.7em);
  -webkit-transition: opacity, width, min-width, visibility, -webkit-transform;
  transition: opacity, width, min-width, visibility, -webkit-transform;
  transition: transform, opacity, width, min-width, visibility;
  transition: transform, opacity, width, min-width, visibility, -webkit-transform;
  -webkit-transition-timing-function: ease;
          transition-timing-function: ease;
  -webkit-transition-duration: 0.3s, 0.25s, 0.15s, 0.15s, 0.01s;
          transition-duration: 0.3s, 0.25s, 0.15s, 0.15s, 0.01s;
  -webkit-transition-delay: 0.3s, 0.25s, 0.3s, 0.3s, 0.35s;
          transition-delay: 0.3s, 0.25s, 0.3s, 0.3s, 0.35s;
  overflow: hidden;
}
.context--sub .context__item {
  padding-left: 2em;
}
.context--sub i[class*="entypo-"] {
  -webkit-transform: translateX(-2.25em);
          transform: translateX(-2.25em);
}
.context--sub.oppositeX {
  right: 100%;
  left: auto;
  -webkit-transform: translateX(0.7em);
          transform: translateX(0.7em);
}
.context--sub.oppositeY {
  top: auto;
  bottom: -0.4em;
}
.context__header, .context__item {
  padding-left: 2.5em;
  padding-right: 1.5em;
  padding-top: 0.3em;
  padding-bottom: 0.35em;
}
.context__header, .context__divider {
  margin-top: 0.25em;
  margin-bottom: 0.25em;
  border-bottom: 1px solid rgba(208, 199, 255, 0.3);
}
.context__header {
  font-weight: 700;
  padding-bottom: 0.5em;
}
.context__item {
  border-radius: 3px;
  position: relative;
}
.context__item:not(.context__item--nope):hover {
  background-color: rgba(255, 255, 255, 0.09);
  color: white;
}
.context__item:not(.context__item--nope):hover .context--sub {
  opacity: 1;
  -webkit-transform: translateX(0);
          transform: translateX(0);
  -webkit-transition-delay: 0.2s, 0.25s, 0.2s, 0.2s, 0s;
          transition-delay: 0.2s, 0.25s, 0.2s, 0.2s, 0s;
  border-radius: 0 3px 3px 3px;
  visibility: visible;
}
.context__item:last-child {
  margin-bottom: 0.25em;
}
.context__item:first-child {
  margin-top: 0.25em;
}
.context__item--nope {
  color: rgba(255, 255, 255, 0.3);
}
.context__item--active {
  -webkit-animation: flash 0.5s ease 1;
          animation: flash 0.5s ease 1;
}
.context a {
  cursor: default;
  color: inherit;
  text-decoration: none;
  display: block;
}
.context [class*="entypo-"] {
  font-style: normal;
  position: absolute;
  -webkit-transform: translateX(-2em);
          transform: translateX(-2em);
  width: 2em;
  text-align: right;
}
.context [class*="entypo-"].post {
  -webkit-transform: translateY(-55%);
          transform: translateY(-55%);
  right: 0;
  top: 50%;
}
.context [class*="entypo-"]:before {
  font-family: 'entypo', sans-serif;
  margin-right: 0.5em;
}

@-webkit-keyframes flash {
  0% {
    background: rgba(255, 255, 255, 0);
  }
  20% {
    background: rgba(255, 255, 255, 0.4);
  }
}

@keyframes flash {
  0% {
    background: rgba(255, 255, 255, 0);
  }
  20% {
    background: rgba(255, 255, 255, 0.4);
  }
}
            
          
!
            
              $(function() {
    var $doc = $(document),
        $context = $(".context:not(.context--sub)");
    $doc.on("contextmenu", function(e) {
        var $window = $(window),
            $sub = $context.find(".context--sub");
        $sub.removeClass("oppositeX oppositeY");
        e.preventDefault();
        var w = $context.width();
        var h = $context.height();
        var x = e.clientX;
        var y = e.clientY;
        var ww = $window.width();
        var wh = $window.height();
        var padx = 30;
        var pady = 20;
        var fx = x;
        var fy = y;
        var hitsRight = (x + w >= ww - padx);
        var hitsBottom = (y + h >= wh - pady);
        if (hitsRight) {
            fx = ww - w - padx;
        }
        if (hitsBottom) {
            fy = wh - h - pady;
        }
        $context.css({
            left: fx - 1,
            top: fy - 1
        });
        var sw = $sub.width();
        var sh = $sub.height();
        var sx = $sub.offset().left;
        var sy = $sub.offset().top;
        var subHitsRight = (sx + sw - padx >= ww - padx);
        var subHitsBottom = (sy + sh - pady >= wh - pady);
        if (subHitsRight) {
            $sub.addClass("oppositeX");
        }
        if (subHitsBottom) {
            $sub.addClass("oppositeY");
        }
        $context.addClass("is-visible");
        $doc.on("mousedown", function(e) {
            var $tar = $(e.target);
            if (!$tar.is($context) && !$tar.closest(
                ".context").length) {
                $context.removeClass("is-visible");
                $doc.off(e);
            }
        });
    });
    $context.on("mousedown touchstart",
        ".context__item:not(.context__item--nope)", function(e) {
            if (e.which === 1) {
                var $item = $(this);
                $item.removeClass("context__item--active");
                setTimeout(function() {
                    $item.addClass("context__item--active");
                }, 10);
            }
        });
    // hack the preview for codepenzies
    setTimeout(function() {
        $doc.trigger("contextmenu");
        $context.css({
            top: 120,
            left: 32
        }).addClass("is-visible");
    }, 1000);
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console