如何握住悬停框?#html、#css、#js
How to hold hover box? #html, #css, #js
请检查此链接 https://jsfiddle.net/mth4d7xt/1/,我的问题是当和框悬停并将 img 更改为边框框时也会更改 img 下的文本。
我想在向下时仍然悬停在框上,并想在 img 下选择链接
<div class="container">
<article class="caption">
<img class="caption__media" src="http://farm7.staticflickr.com/6088/6128773012_bd09c0bb4e_z_d.jpg" />
<div class="caption__overlay">
<p>
Alaska is a U.S. state situated in the northwest extremity of the North American continent. Bordering the state is Canada to the east, the Arctic Ocean to the north, and the Pacific Ocean to the west and south, with Russia (specifically, Siberia) further west across the Bering Strait.
</p>
</div>
</article>
<div class="box_text">
<div class="a">sample text</div>
<div class="b">
<a href="#">text</a>
<a href="#">text</a>
<a href="#">text</a>
</div>
</div>
感谢您的帮助!
改用 .container
元素。
j查询:
$(document).ready(function() {
$('.b').hide();
$('.container').hover(function() {
$('.a').toggle();
$('.b').toggle();
});
})
.CSS:
.container:hover .caption::before {
background: rgba(255, 255, 255, 1);
}
.container:hover .caption .caption__overlay {
-webkit-transform: translateY(0);
transform: translateY(0);
}
小提琴:https://jsfiddle.net/7c7LdL6a/
将悬停绑定到容器而不是标题:
$(document).ready(function() {
$('.b').hide();
$('.container').hover(function() {
$('.a').toggle();
$('.b').toggle();
});
})
https://jsfiddle.net/mth4d7xt/3/
相关文章:
- css/js:通过滚动固定位置
- 什么CSS/JS技巧驱动镜像反转http://com.google愚人节页面
- CSS/js Flip Cards
- 将回车键映射到HTML/CSS/JS中的按钮
- CSS/.JS问题,<ul><李>在Megamenu中
- 最小化CSS/JS文件,并使用命令行创建一个文件
- 使用公共JS文档优化静态网站的CSS/JS导入
- HTML/CSS/JS切换不同的谷歌日历是同一个框架
- 使用 PHP 将 css/js 文件分配给 html 文档
- HTML/CSS/JS 构建工具
- Knockout.js在标头中绑定css/js库
- 如何在HTML/CSS/JS中为表/列表应用行虚拟化
- 当包含在CSS/JS/HTML中时,我如何得出正确的目录路径
- 这段代码有什么问题(responsible html-css-js)
- CSS/JS:如何在悬停时显示文本,并显示点击href的文本框
- 如何使css/js对象在所有浏览器上都相同
- html+css+js组合在Google Chrome或Safari浏览器中无法正常工作
- CSS/JS转换:translate3d和滚动-在Android上流畅,在iPhone上没有动力
- 使用CSS/JS反转和重新反转元素
- 将复杂的html/css/js元素添加到单个Wordpress页面中