javascript - 如何握住悬停框? #html、#css、#js

标签 javascript jquery html css jquery-ui

请检查此链接 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 元素代替..

jQuery:

$(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);
}

fiddle :https://jsfiddle.net/7c7LdL6a/

关于javascript - 如何握住悬停框? #html、#css、#js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36088001/

相关文章:

javascript - 在 HTML 表格中选择和取消选择 td

javascript - jQuery AJAX 和 XML 获取节点值

javascript - 为什么 css transition 会延迟工作

javascript - Angular js中的搜索过滤器

javascript - 仅禁止空格或仅在用户键入字母时显示警报

javascript - html5/javascript乘以输入类型并显示在表格中

html - 如何从 CSS 控制 Div 以进行打印 View

javascript - Google 表格仅查看对运行应用脚本的用户的保护

javascript - 当滚动到达特定部分时运行 $ ('a' ).animate()

javascript - 如何在 three.js 上叠加 HTML 文本/按钮?