Skip to content

Instantly share code, notes, and snippets.

@talnetd
Created June 21, 2013 10:00
Show Gist options
  • Save talnetd/5830209 to your computer and use it in GitHub Desktop.
Save talnetd/5830209 to your computer and use it in GitHub Desktop.
A CodePen by Tin Aung Linn. Html5 Context Menu - Inspired from David and tweet myself a little. Just miss obey DRY :P.
<section id="header" contextmenu="mymenu">
<header>
<h1>HTML5</h1>
<menu type="context" id="mymenu">
<menuitem label="Refresh Post" onclick="window.location.reload();" >
</menuitem>
<menu label="Share on...">
<menuitem label="Twitter" onclick="goShare('http://twitter.com/intent/tweet?text=' + document.title + ': ' + window.location.href);">
</menuitem>
<menuitem label="Facebook" onclick="goShare('http://facebook.com/sharer/sharer.php?u=' + window.location.href);">
</menuitem>
</menu>
</menu>
</header>
</section>
function goShare(url) {
window.open(url,"shareWindow");
}
body {
padding:0;
margin:0;
}
.container {
width:50%;
height: auto;
margin: auto;
padding-top: 10%;
}
#header {
width:100%;
text-align: center;
padding-top:45px;
padding-bottom: 50px;
background:#ddd;
border:solid 5px #000;
}
#header header h1 {
font-size: 5em;
color: #fff;
text-shadow: 3px 3px 3px #000;
font-family: Arial;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment