【发布时间】:2016-12-11 19:25:51
【问题描述】:
我有 iframe 页面,当您悬停时会显示这些页面。我想将其更改为单击。不知何故,它不起作用。
JS:
$('section div').mouseenter(function(){
$(this).css('height', '80vh');
$(this).css('width', '100%');
$('#info').css('width', '100%');
});
$('section div').mouseleave(function(){
$(this).css('height', '2.5vh');
$(this).css('width', '100%');
$('#info').css('width', '100%');
});
CSS:
iframe {
border: 0;
width: 100%;
height: 100%;
transition: 1s;
z-index: 2000;
}
#info {
position: fixed;
top: 0;
height: 80vh;
width: 100%;
transition: 1s;
z-index: 1;
}
section {
position: fixed;
bottom: 0;
width: 100%;
z-index: 2000;
}
HTML:
<body>
<section></section>
</body>
有时我的试用成功了,但仅在 iframe 本身(空白)上,因此当 iframe 充满内容时没有任何反应,也许这只是目标的问题。
【问题讨论】:
-
你的
click代码在哪里? -
我制作的点击代码根本不起作用。这是我想要在点击时实现的,而不是 mouseenter 和 mouseleave:jsfiddle.net/T73A/tsq8h6pc
-
非工作代码需要在问题本身中。
-
这里是:$('section div').click(function(){ $(this).css('height', '80vh'); $(this).css('宽度', '100%');$('#info').css('width', '100%');});不知何故,我无法获得正确的碰撞箱,我现在正在尝试其他方法。
-
问题本身。不作为缺少格式的评论。
标签: javascript click mouseenter