- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的弹出窗口在右上角有一个“关闭”按钮,一些带有背景图像的文本,底部有一个“打印”按钮。加载页面时会自动显示弹出窗口。如果有人关闭它,除非您重新加载页面,否则无法将其取回。当按下字母“G”或“g”但无济于事时,我一直试图让弹出窗口在关闭后显示出来。我找到了 this我认为可以将其实现到我现有的代码中,但我无法做到这一点。
请注意,我更愿意使用当前 JS 代码中的现有功能,而不是必须下载的插件。我的代码如下:
$(document).ready(function() {
$(function(){
$('#PopUp').css("visibility", "visible");
$('#PopUp').css("opacity", 1);
});
$( ".close" ).click(function() {
$('#PopUp').css("visibility", "hidden");
$('#PopUp').css("opacity", 0);
});
});
function printDiv()
{
var content = document.getElementById('printableDiv').innerHTML;
var win = window.open();
win.document.write(content);
win.print(); // JavaScript Print Function
win.close(); //It will close window after Print.
document.getElementById("pdf1").style.top=117 + "px";
}
.t {
-webkit-transform-origin: top left;
-moz-transform-origin: top left;
-o-transform-origin: top left;
-ms-transform-origin: top left;
-webkit-transform: scale(0.25);
-moz-transform: scale(0.25);
-o-transform: scale(0.25);
-ms-transform: scale(0.25);
z-index: 2;
position: absolute;
white-space: pre;
overflow: visible;
}
#t1_1{left:256px;top:35px;letter-spacing:0.1px;}
#t2_1{left:334px;top:87px;word-spacing:-0.1px;}
#t3_1{left:210px;top:123px;}
#t4_1{left:238px;top:123px;word-spacing:-0.3px;}
#t5_1{left:210px;top:141px;}
#t6_1{left:210px;top:160px;}
#t7_1{left:210px;top:179px;}
#t8_1{left:238px;top:141px;letter-spacing:-0.1px;word-spacing:-0.1px;}
#t9_1{left:238px;top:160px;word-spacing:-0.1px;}
#ta_1{left:238px;top:179px;word-spacing:-0.1px;}
#tb_1{left:343px;top:242px;letter-spacing:-0.1px;}
#tc_1{left:210px;top:278px;}
#td_1{left:210px;top:297px;}
#te_1{left:210px;top:315px;}
#tf_1{left:210px;top:334px;}
#tg_1{left:238px;top:278px;word-spacing:-0.1px;}
#th_1{left:238px;top:297px;word-spacing:-0.1px;}
#ti_1{left:238px;top:315px;word-spacing:-0.2px;}
#tj_1{left:238px;top:334px;word-spacing:-0.1px;}
#tk_1{left:286px;top:393px;word-spacing:-0.1px;}
#tl_1{left:210px;top:429px;}
#tm_1{left:210px;top:448px;}
#tn_1{left:210px;top:466px;}
#to_1{left:210px;top:485px;}
#tp_1{left:238px;top:429px;word-spacing:-0.3px;}
#tq_1{left:238px;top:448px;word-spacing:-0.1px;}
#tr_1{left:238px;top:466px;word-spacing:-0.1px;}
#ts_1{left:238px;top:485px;word-spacing:-0.2px;}
#tt_1{left:326px;top:544px;letter-spacing:-0.1px;}
#tu_1{left:210px;top:580px;}
#tv_1{left:210px;top:599px;}
#tw_1{left:210px;top:618px;}
#tx_1{left:238px;top:618px;}
#ty_1{left:210px;top:636px;}
#tz_1{left:238px;top:636px;}
#t10_1{left:210px;top:655px;}
#t11_1{left:238px;top:580px;word-spacing:-0.1px;}
#t12_1{left:238px;top:599px;word-spacing:-0.2px;}
#t13_1{left:238px;top:655px;word-spacing:-0.1px;}
#t14_1{left:264px;top:716px;word-spacing:-0.2px;}
#t15_1{left:210px;top:752px;}
#t16_1{left:210px;top:771px;}
#t17_1{left:210px;top:789px;}
#t18_1{left:210px;top:808px;}
#t19_1{left:238px;top:752px;word-spacing:-0.1px;}
#t1a_1{left:238px;top:771px;word-spacing:-0.1px;}
#t1b_1{left:238px;top:789px;word-spacing:-0.2px;}
#t1c_1{left:238px;top:808px;word-spacing:-0.1px;}
.s1_1{
FONT-SIZE: 85.4px;
FONT-FAMILY: Arial;
color: rgb(0,0,0);
FONT-WEIGHT: bold;
}
.s2_1{
FONT-SIZE: 61.2px;
FONT-FAMILY: Arial;
color: rgb(0,0,0);
FONT-WEIGHT: bold;
}
.s3_1{
FONT-SIZE: 61.2px;
FONT-FAMILY: SymbolMT_1z5;
color: rgb(0,0,0);
}
.s4_1{
FONT-SIZE: 61.2px;
FONT-FAMILY: Arial;
color: rgb(0,0,0);
}
div {
padding-top: 10px;
}
.button {
font-size: 1em;
padding: 10px;
color: #fff;
border: 2px solid orange;
border-radius: 20px/50px;
text-decoration: none;
cursor: pointer;
transition: all 0.3s ease-out;
}
.button:hover {
background: orange;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: visible;
opacity: 1;
height: 578%;
width: 117.5%;
}
.overlay:target {
visibility: hidden;
opacity: 0;
display:none;
}
.PopUp {
margin: 50px auto;
padding: 0px;
background: #fff;
border-radius: 5px;
width: 60%;
position: relative;
transition: all 5s ease-in-out;
}
.PopUp .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.PopUp .close:hover {
color: orange;
}
.PopUp .content {
max-height: 117.5%;
overflow: auto;
}
.pdf1 {
width: 935px;
height: 1210px;
background-color: white;
-moz-transform: scale(1);
z-index: 0;
border: none;
}
<div id="PopUp" class="overlay">
<div class="PopUp">
<a class="close" href="#">✕</a>
<div class="content">
<div class="printableDiv" id="printableDiv"></div>
<div id="p1" class=p1" style="overflow: hidden; position: relative; width: 885px; height: 878px;">
<!-- Begin page background -->
<div id="pg1Overlay" style="width:100%; height:100%; position:absolute; z-index:1; background-color:rgba(0,0,0,0); -webkit-user-select: none;"></div>
<div id="pg1" class="pg1" style="-webkit-user-select: none;"><img src="http://i.imgur.com/vcY42CW.png" id="pdf1" class="pdf1"></img></div>
<!-- End page background -->
<!-- Begin text definitions (Positioned/styled in CSS) -->
<div id="t1_1" class="t s1_1">Player Selection Criteria Evaluator Cue Card</div>
<div id="t2_1" class="t s2_1">Skating – speed, quickness, technique</div>
<div id="t3_1" class="t s3_1">♦</div>
<div id="t4_1" class="t s4_1">Forward and Backward</div>
<div id="t5_1" class="t s3_1">♦</div>
<div id="t6_1" class="t s3_1">♦</div>
<div id="t7_1" class="t s3_1">♦</div>
<div id="t8_1" class="t s4_1">Turn both directions</div>
<div id="t9_1" class="t s4_1">Stop both directions</div>
<div id="ta_1" class="t s4_1">Are they in a good position for stability and strength</div>
<div id="tb_1" class="t s2_1">Passing – technique, control, vision</div>
<div id="tc_1" class="t s3_1">♦</div>
<div id="td_1" class="t s3_1">♦</div>
<div id="te_1" class="t s3_1">♦</div>
<div id="tf_1" class="t s3_1">♦</div>
<div id="tg_1" class="t s4_1">Forehand and Backhand</div>
<div id="th_1" class="t s4_1">To moving and stationary target</div>
<div id="ti_1" class="t s4_1">Vision – do they take a look and select best option</div>
<div id="tj_1" class="t s4_1">Advanced – board passes, chips, saucer passes</div>
<div id="tk_1" class="t s2_1">Puck Control – technique, open ice, confined space</div>
<div id="tl_1" class="t s3_1">♦</div>
<div id="tm_1" class="t s3_1">♦</div>
<div id="tn_1" class="t s3_1">♦</div>
<div id="to_1" class="t s3_1">♦</div>
<div id="tp_1" class="t s4_1">Open carry with speed</div>
<div id="tq_1" class="t s4_1">Execute dekes and fakes on the 1 on 1</div>
<div id="tr_1" class="t s4_1">Can they handle the puck in traffic and tight space</div>
<div id="ts_1" class="t s4_1">Ability to maintain control while being stick checked</div>
<div id="tt_1" class="t s2_1">Shooting – technique, accuracy, velocity</div>
<div id="tu_1" class="t s3_1">♦</div>
<div id="tv_1" class="t s3_1">♦</div>
<div id="tw_1" class="t s3_1">♦</div>
<div id="tx_1" class="t s4_1">Velocity</div>
<div id="ty_1" class="t s3_1">♦</div>
<div id="tz_1" class="t s4_1">Accuracy</div>
<div id="t10_1" class="t s3_1">♦</div>
<div id="t11_1" class="t s4_1">Forehand and backhand</div>
<div id="t12_1" class="t s4_1">Wrist shot, snap shot, slap shot</div>
<div id="t13_1" class="t s4_1">Shot Selection – do they select the best shot for the opportunity?</div>
<div id="t14_1" class="t s2_1">Game Understanding – Principles of Offence and Defence</div>
<div id="t15_1" class="t s3_1">♦</div>
<div id="t16_1" class="t s3_1">♦</div>
<div id="t17_1" class="t s3_1">♦</div>
<div id="t18_1" class="t s3_1">♦</div>
<div id="t19_1" class="t s4_1">Player understands positional play</div>
<div id="t1a_1" class="t s4_1">Player supports the puck on the defensive and offensive side of puck</div>
<div id="t1b_1" class="t s4_1">Player communicates with teammates</div>
<div id="t1c_1" class="t s4_1">Player has the ability to read and react.</div>
</div>
</div>
<input type="button" onclick="printDiv()" value="Print">
</div>
</div>
</div>
最佳答案
您可以在文档主体(或您喜欢的其他目标)上设置一个 keyup 事件来显示弹出。
$(document.body).keyup(function(e){
var key=e.which||e.keyCode;
if(key==71){
$("#PopUp").css({opacity:"1",visibility:"visible"})
};
关于javascript - 按下键时显示弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43574021/
我在 php 方面遇到了一个小问题,我发现很难用语言来解释。我有一个包含键值的关联数组。我想制作一个函数(或者如果已经有一个函数),它将一个数组作为输入并删除重复项,但两种方式都是如此。 例如: 在我
我有一个在系统托盘中运行的应用程序,是否可以允许用户通过 C# 中的 Windows 键 + 键 恢复该应用程序? 谢谢 最佳答案 是的,使用 Windows API。我认为 Windows 键与 C
我正在使用 Waterline通过 Sails 查询 MySQL 数据库。我找到了 2 种方法。 不知道哪个更好? 顺便问一下,如何处理这两种情况的错误? 1. Model.findOne().whe
我正在尝试测试是否按下了 Alt 键。 我的支票类似于: private void ProcessCmdKey(Keys keyData) { if (keyData == Keys.Alt) {
我正在使用 Selenium WebDriver 和 Ruby 进行自动化测试。我需要点击一个按钮。我无法通过 id 或 css 或 xpath 获取按钮元素,因为按钮是透明的。我想使用 Tab 和
我是 IntelliJ 的新手,我看到一个启动提示说,“任何工具窗口中的 ⎋ 键都会将焦点移动到编辑器。”但是,我不知道⎋键是什么。我一直在编程很长时间。我的键盘上可能有一个我多年来一直错过的键吗?
我使用 OMDB API 创建了一个电影搜索页面。我遇到的问题是,如果我搜索一部包含多个单词的电影,此 API 会出错,因为 API 的 URL 必须在 URL 中的每个单词之间有 + 键。所以我想知
我已经用 Elasticsearch 玩了大约一天了,所以我非常陌生。我正在尝试 POST/import 一个简单的文件: { "compression" : "none", "com
enter image description here 在此示例中,要记录带有“title”和“director”键的属性值,使用 obj[key]。因为我们已经处于对象的执行上下文中:在本例中是电
我是新开类。 我使用新的电子邮件 ID 和密码在 openshift 上创建了一个项目。让我们称之为 firstApp 。我做了 rhc 设置和我的 ssh key 与我的项目相关联。 我的 frie
当我使用 Jackson 反序列化 json 字符串时,我通常不想创建所有 bean 类的属性,而且我只需要一些 json 字符串的字段,其他字段我不需要。所以我经常只在我需要的 java 类 bea
我想编写一个带有 keys/keys* 的规范,但能够内联值规范,但不支持 by design ,我明白了其背后的原因。然而,有时,本地图存在特定上下文时,您确实希望(或者只是通过遗留或第三方)键和值
my %fruit_colors = ("apple", "red", "banana", "yellow"); my @fruits = keys %fruit_colors; my @colors
我正在使用 vb.net 2008 和 DataGridView。我正在寻找允许我将 enter 键移动到右侧的下一列而不是在保持在同一列时向下移动一行的代码。 最佳答案 如果您正在确认编辑,只需移动
我刚刚开始学习编码,我遇到了这个我无法理解的问题。 “我们将添加的第二个函数称为搜索,它将以名字作为参数。它将尝试将收到的名字与我们 friend 联系人列表中的任何名字相匹配。如果它找到匹配项,就会
我已经在 Python 中运行了下面的代码,以从文本文件中生成单词列表及其计数。我该如何从“Frequency_list”变量中过滤掉计数为 1 的单词? 另外,如何将底部的打印语句循环导出到CSV
我正在尝试 XSLT 中的查找表示例,但无法使其正常工作
是否可以在 Javascript/Typescript 中编写一个将参数名称/键作为字符串返回的函数? function foo(arg) {...} let user = new User(); f
我正在尝试创建一个带有键/值的对象,但是当我看到该对象时,键没有正确填充.. 我希望键是 - 0,1,2,3 但它显示“索引”作为键。 > categories = ["09/07/2016 00:0
将 Android Studio 从 1.5 升级到 2.0 后,模拟器(现在版本为 25.1.1,我在其上配置了模拟硬件键盘)不再将 [Esc] 键识别为等同于 [Back] 按钮。 如何恢复这个有
我是一名优秀的程序员,十分优秀!