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 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

              
                <button id="output_for_contextmenu" onclick="setTimeout(function(){$('#contextmenu').css({'top':'2em','left':'2em'}).addClass('on');$('#search').focus();}, 1)">out</button>


<section id="contextmenu">
  <div> <i onmouseover="$(this).removeClass('icon-close').addClass('icon-close-circle').css({'color':'inherit'})" onmouseout="$(this).addClass('icon-close').removeClass('icon-close-circle')" onclick="$('#contextmenu').removeClass('on')" class="icon-close context_disable"
      style="position: absolute; top:1ex; right: 1ex; left: initial; margin: 0; padding:0; color:transparent;"></i>
    <div class="context_disable"> <i class="icon-magnify"></i>
      <input type="text" id="search" value="[##_search_text_##]" onkeypress="if (event.keyCode == 13) { try{window.location.href='/search/' + looseURIEncode($('#search')[0].value);$('#search')[0].value = ''; return false;}catch(e){} }" size="20" placeholder="블로그 글 검색"
      />
    </div>
    <!-- end of Search -->
  </div>
  <div>
    <div class="context_able" onclick="location.href='notice'" data-context="자세한 건 공지에"><span>퍼가지 마세요...</span>
    </div>
    <div class="context_disable"><span>링크로 공유하세요 ㅠㅠ</span>
    </div>
    <div class="context_disable"> <span>부탁할게요 ^_&lt;~*</span>
      <section class="contextmenu">
        <div>
          <p>test 3-1</p>
          <p>test 3-2</p>
          <p class="context_disable">test 3-3</p>
        </div>
        <div>
          <p class="context_disable">test 4-1</p>
          <p>test 4-2</p>
          <p class="context_disable">test 4-3</p>
        </div>
      </section>
    </div>
  </div>
  <div>
    <div class="context_able" onclick="location.href='/category'"><i class="icon-file-document-box"></i><span>모든 글 보기</span></div>
    <div class="context_able" onclick="location.href='/notice'"><i class="icon-alert-circle"></i><span>공지</span></div>
    <div class="context_able" onclick="location.href='/guestbook'"><i class="icon-forum"></i><span>방명록</span></div>
  </div>
  <div>
    <div onclick="$(this).children().toggleClass('on')"> <i class="icon-share-variant"></i><span>Share to...</span>
      <section class="contextmenu" style="width:160px;">
        <div>
          <p class="context_able" onclick="window.open('https://www.facebook.com/sharer/sharer.php?u='+document.location.href,'','height=300,width=550').focus(); return false;"> <i class="icon-facebook-box" style="color:#3F51B5;"></i><span>페이스북 공유</span>
          </p>
          <p class="context_able" onclick="window.open('https://twitter.com/share?url='+document.location.href+'&nbsp;@Bloger_JinH&amp;text=[##_page_title_##]','','height=260,width=550').focus(); return false;"> <i class="icon-twitter" style="color:#03A9F4;"></i><span>트위터 공유</span>
          </p>
          <p class="context_able" onclick="window.open('https://plus.google.com/share?url='+document.location.href,'','height=450,width=550').focus(); return false;"> <i class="icon-google-plus" style="color:#D32F2F;"></i><span>구글+ 공유</span>
          </p>
        </div>
        <div>
          <p class="context_able" onclick="window.open('https://story.kakao.com/share?url='+document.location.href,'','height=450,width=550').focus(); return false;">
            <svg viewBox="0 0 32 32" style="fill:#FFD500; width:16px; height:16px;">
                                            <path d="M22.869 5.033v11.045c0 0 0.117 3.786-2.225 7.649-1.796 2.964-4.017 4.733-4.954 5.397-0.285 0.202-0.646 0.028-0.646 0.028l-3.807-4.114c0 0-0.31-0.393 0.057-0.691 0.75-0.607 2.354-1.98 3.145-3.312 1.267-2.136 1.132-3.493 1.132-3.493s-4.020 0-5.23 0-1.21-1.21-1.21-1.21 0-9.776 0-11.142 1.21-1.366 1.21-1.366 10.109 0 11.319 0 1.209 1.21 1.209 1.21z"
                                            />
                                        </svg><span>카카오스토리 공유</span>
          </p>
          <p class="context_able" onclick="window.open('http://www.band.us/plugin/share?body=[##_page_title_##]('+document.location.href+')&amp;route=jinh.tistory.com','','width=410,height=540').focus(); return false;" target="_blank">
            <svg style="height: 16px;width: 16px; background: url(https://developers.band.us/img/share/button/ko/20x20.png) center center no-repeat; background-size: 15px; border: none;"></svg><span>밴드 공유</span>
          </p>
        </div>
      </section>
    </div>
    <div onclick="$(this).children().toggleClass('on')"> <i class="icon-thumb-up"></i><span>Follow & Contact</span>
      <section class="contextmenu" style="width:160px;">
        <div>
          <p class="context_able" onclick="window.open('https://www.facebook.com/Sample.by.JinH', '_blank').focus(); return false;" target="_blank"> <i class="icon-facebook-box" style="color:#3F51B5;"></i><span>Facebook</span>
          </p>
          <p class="context_able" onclick="window.open('https://twitter.com/bloger_jinh', '_blank').focus(); return false;" target="_blank"> <i class="icon-twitter" style="color:#03A9F4;"></i><span>Twitter</span>
          </p>
        </div>
        <div>
          <p class="context_able" onclick="window.open('mailto:jinh@tistory.com', '_blank').focus(); return false;" target="_blank"> <i class="icon-email"></i><span>Mail</span>
          </p>
        </div>
      </section>
    </div>
    <p class="context_able" onclick="window.open('http://feeds2.feedburner.com/jinh'); return false"> <i class="icon-rss-box"></i><span>RSS 구독</span>
    </p>
  </div>
  <div>
    <div class="context_disable" onclick="window.open('/13');">2007-2016 © JinH
      <iframe class="context_ddabong" src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2FSample.by.JinH&amp;send=false&amp;layout=button_count&amp;width=100&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21"></iframe>
    </div>
  </div>
  <button onclick="$('#contextmenu').removeClass('on')" style="display:none">메뉴 닫기</button>
</section>
<!-- context-menu close -->
              
            
!

CSS

              
                #contextmenu, .contextmenu {
	z-index:1000;
	position: fixed;
	opacity:0;
	visibility: hidden;
	cursor: default;
	width:300px;
	color:rgba(0,0,0,.5);
	background-color:#fff;
	border: 1px solid #bbb;
	box-shadow: 0 2px 5px rgba(0,0,0,.25);
	transition:.25s;
	transition-property: opacity, transform, margin;
	top:50%;
}
#contextmenu {
	font-size: 12px; font-family: none;
	top:2em; left:-302px;
	transform: perspective(500px) rotateX(15deg);
	margin-top:-2em;
}
#contextmenu.on {
  transform: none;
  transform-origin: 50% 100%;
  margin-top:0;
  visibility:visible;
  opacity:1;
}
.contextmenu	{
	position: absolute;
	width: 300px;
	white-space: nowrap;
	top: -7px; left: calc(100% - .5em);
	}
#contextmenu > div,
.contextmenu > div              { padding: .5em 0; border-bottom: 1px solid rgba(0,0,0,.1); }
#contextmenu > div:last-child,
.contextmenu > div:last-child  { border-bottom: none; }
#contextmenu > div > *,
.contextmenu > div > *          { padding: .5em 2em .5em 3em; margin:0; text-decoration: none; }
#contextmenu > div > *:not(.context_disable),
.contextmenu > div > *:not(.context_disable)         { color:#000; position: relative; }
#contextmenu > div > *:not(.context_disable):hover,
#contextmenu > div > *:not(.context_disable):hover > i,
.contextmenu > div > *:not(.context_disable):hover,
.contextmenu > div > *:not(.context_disable):hover > i  { background:rgba(158,158,158,0.2); color:#fff!important; }
#contextmenu > div > *:not(.context_disable):hover > .contextmenu, .contextmenu:hover	{ opacity:1; visibility: visible; }

#contextmenu > div > *:not(.context_disable):not(.context_able):after	{ position: absolute; font:16px 'icon'; content: "\f383"; right: 1em; }

#contextmenu svg,
#contextmenu [class^='icon']		{ position: absolute; margin:0; font-size:16px; left: .7em; color:rgba(0,0,0,.5); fill:rgba(0,0,0,.5); }
#contextmenu > div > *:not(.context_disable):hover > svg,
.contextmenu > div > *:not(.context_disable):hover > svg  {  }

#contextmenu [data-context]:after,
#contextmenu .context_disable[data-context]:hover:after   { content:attr(data-context); color:rgba(0,0,0,.5); float:right; }
#contextmenu [data-context]:hover:after   { color:#fff; }

.context_ddabong	{ border:none; overflow:hidden; width:96px; height:21px; float:right; margin-top: -.2em; }
              
            
!

JS

              
                $(document).on("contextmenu", function(event) {
  event.preventDefault();
  var context_x,
    context_y,
    con_sub_x,
    con_sub_y;
  if ($(document).width() - $("#contextmenu").outerWidth() > event.pageX) {
    context_x = event.pageX;
  } else {
    context_x = $(document).width() - $("#contextmenu").outerWidth();
  }
  if ($(window).height() - $("#contextmenu").outerHeight() > event.pageY - $(document).scrollTop()) {
    context_y = event.pageY - $(document).scrollTop();
  } else {
    context_y = $(window).height() - $("#contextmenu").outerHeight();
  }
  $("#contextmenu").css({
    'left': context_x + "px",
    'top': context_y + "px"
  }).addClass("on");
  $('#search').focus();
  $('.contextmenu').parent().hover(function() { //하위 메뉴 항목
    if ($(document).width() - $("#contextmenu").outerWidth() - $(this).children().last().outerWidth() > event.pageX) {
      con_sub_x = 'calc(100% - .5em)';
    } else {
      con_sub_x = 'calc(' + (-$(this).children().last().outerWidth()) + 'px + .5em)';
    }
    if ($(window).height() - $(this).children().last().outerHeight() - $(this).position().top > event.pageY - $(document).scrollTop()) {
      con_sub_y = '-7px';
    } else {
      //con_sub_y = 'calc(-100% - 22px + ' + $(this).position().top + 'px)'; //as you wish
      con_sub_y = $(window).height() - $("#contextmenu").position().top - $(this).position().top - $(this).children().last().outerHeight() + 'px';
    }
    $(this).children().last().css({
      'left': con_sub_x,
      'top': con_sub_y
    })
  });
}).on("click", function() {
  if ($('#contextmenu:hover').length > 0) {
    if ($('.context_able:hover').length > 0) {
      $('#output_for_contextmenu').html('1');
      $("#contextmenu").removeClass("on");
    } else {
      $('#output_for_contextmenu').html('2');
    }
  } else {
    $('#output_for_contextmenu').html('3');
    $("#contextmenu").removeClass("on");
  }
});

$(document).on('copy', function() { //복사방지
  $("#contextmenu").css({
    'left': '2em',
    'top': '2em'
  }).addClass("on");
  return false;
});
              
            
!
999px

Console