実装:
Hキーを押すとポップアップを表示。もう一度押すと非表示。
HTML
<div class="hover_bkgr_fricc">
<span class="helper"></span>
<div>
// HTML here
</div>
</div>
CSS
/* # ヘルプポップアップ */
/* Popup box BEGIN */
.hover_bkgr_fricc{
background:rgba(0,0,0,.4);
cursor:pointer;
display:none;
height:100%;
position:fixed;
text-align:center;
top:0;
width:100%;
z-index:10000;
}
.hover_bkgr_fricc .helper{
display:inline-block;
height:100%;
vertical-align:middle;
}
.hover_bkgr_fricc > div {
background-color: #fff;
box-shadow: 10px 10px 60px #555;
display: inline-block;
height: auto;
max-width: 551px;
min-height: 100px;
vertical-align: middle;
width: 60%;
position: relative;
border-radius: 8px;
padding: 15px 5%;
}
.popupCloseButton {
background-color: #fff;
border: 3px solid #999;
border-radius: 50px;
cursor: pointer;
display: inline-block;
font-family: arial;
font-weight: bold;
position: absolute;
top: -20px;
right: -20px;
font-size: 25px;
line-height: 30px;
width: 30px;
height: 30px;
text-align: center;
}
.popupCloseButton:hover {
background-color: #ccc;
}
.trigger_popup_fricc {
cursor: pointer;
font-size: 20px;
margin: 20px;
display: inline-block;
font-weight: bold;
}
/* Popup box BEGIN */
JavaScript
//# ヘルプポップアップ
var showPopupToggle = "no"
// H to popup help window
function showPopup(e) {
if (e.keyCode == 72) {
if (showPopupToggle == "no"){
$('.hover_bkgr_fricc').show();
showPopupToggle = "yes"
} else {
$('.hover_bkgr_fricc').hide();
showPopupToggle = "no"
}
}
}
document.addEventListener('keyup', showPopup, false);