- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
简而言之,这正在发生:https://jsfiddle.net/exr4hv8z/2/ (尝试将鼠标悬停在按钮上,然后将鼠标移开几次)
无论出于何种原因,元素折叠起来隐藏得很好,但是应该折叠起来以查看的另一个元素不会动画,并且在另一个元素完成后简单地弹出。
HTML:
<div id="nav_bar">
<a href="index.php">
<div class="navbutton_background background_normal collapse in"></div>
<div class="navbutton_background background_hover collapse" style="height: 0;"></div>
<div class="navbutton_background background_click collapse" style="height: 0;"></div>
<button class="navbutton rightborder">Home</button>
</a>
<a href="forum.php">
<div class="navbutton_background background_normal collapse in left_1"></div>
<div class="navbutton_background background_hover collapse left_1" style="height: 0;"></div>
<div class="navbutton_background background_click collapse left_1" style="height: 0;"></div>
<button class="navbutton leftborder rightborder left_1">Forums</button>
</a>
<a href="servers.php">
<div class="navbutton_background background_normal collapse in left_2"></div>
<div class="navbutton_background background_hover collapse left_2" style="height: 0;"></div>
<div class="navbutton_background background_click collapse left_2" style="height: 0;"></div>
<button class="navbutton leftborder rightborder left_2">Servers</button>
</a>
<a href="contact.php">
<div class="navbutton_background background_normal collapse in left_3"></div>
<div class="navbutton_background background_hover collapse left_3" style="height: 0;"></div>
<div class="navbutton_background background_click collapse left_3" style="height: 0;"></div>
<button class="navbutton leftborder rightborder left_3">Contact</button>
</a>
<a href="about.php">
<div class="navbutton_background background_normal collapse in left_4"></div>
<div class="navbutton_background background_hover collapse left_4" style="height: 0;"></div>
<div class="navbutton_background background_click collapse left_4" style="height: 0;"></div>
<button class="navbutton leftborder left_4">About</button>
</a>
</div>
CSS:
#nav_bar
{
background-color: rgba(27, 27, 27, 1);
width: 100%;
height: 5rem;
border-width: 10%;
margin-top: 2rem;
position: relative;
}
.navbutton
{
background-color: rgba(0, 0, 0, 0);
color: rgba(10, 10, 10, 1);
font-weight: bold;
width: 20%;
height: 100%;
position: absolute;
z-index: 1;
border: 0;
border-bottom: 0.5rem solid rgba(0, 0, 0, 0.2);
}
.navbutton_background
{
width: 20%;
height: 100%;
position: absolute;
}
/* Colors for button states */
.background_normal { background-color: rgba(40, 40, 40, 1); }
.background_hover { background-color: rgba(0, 190, 220, 1); }
.background_click { background-color: rgba(0, 210, 240, 1); }
/* Left_# are for positioning each individual button 20*#% away from the left side */
.left_1 { left: 20%; }
.left_2 { left: 40%; }
.left_3 { left: 60%; }
.left_4 { left: 80%; }
.leftborder { border-left: 0.3rem dashed rgba(27, 27, 27, 1); }
.rightborder { border-right: 0.3rem dashed rgba(27, 27, 27, 1); }
JS:
$(document).ready (function () {
$("#nav_bar a").mouseover (function () {
$(this).find (".background_normal").collapse ('hide');
$(this).find (".background_hover").collapse ('show');
});
$("#nav_bar a").mouseout (function () {
$(this).find (".background_hover").collapse ('hide');
$(this).find (".background_normal").collapse ('show');
});
});
编辑:我找到了解决该问题的方法,但我并不真正认为它是一个答案,因为它不会以任何方式阻止或修复此问题。我最终在其余元素下方添加了另一个元素,该元素在鼠标悬停/鼠标移出时更改了颜色,以模仿未正确折叠的元素。更新 fiddle :https://jsfiddle.net/exr4hv8z/3/
最佳答案
改用这个:
$(document).ready (function () {
$("#nav_bar a").hover (function () {
$(this).find (".background_normal").collapse ('hide');
$(this).find (".background_hover").collapse ('show');
},
function () {
$(this).find (".background_hover").collapse ('hide');
$(this).find (".background_normal").collapse ('show');
});
});
关于jquery - Bootstrap collapse 可以隐藏,但不能显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29442318/
我有这个左侧站点菜单: Typography Name 1
我有两个问题: 是否有合理的解释,为什么会这样? 是否有针对这种情况的 CSS 解决方法? 谢谢! table { border-collapse: collapse; pad
我想知道为什么我的类“panel-collapse”“collapse”不起作用。 我刚刚将文件上传到我的服务器上,当我单击链接区域时,它们不起作用(它们不会放下隐藏内容)。但是,它们在我的 Drea
在这种情况下,我完全感到困惑。当我使用 border-collapse: collapse; 从 1px (#1) 到 大 值 (#2) 并回到 1px (#3),我有视觉缺陷。 #1 和#3 相同,
我有两个表,想要使用 Javascript 同步它们的列宽。只要我不为表格设置 CSS 属性 border-collapse:collapse;,它就能在 Google Chrome 中按预期工作。
我正在前端使用 Bootstrap 编写一个个人提要阅读器,并想添加一个“折叠/全部展开”按钮。 这是我的第一个 JavaScript/JQuery 代码,所以除了在 Firefox Develope
我正在使用以下模块:https://roszpun.github.io/vue-collapse/#/ 我似乎无法弄清楚如何正确地将类添加到包装元素,因为我首先考虑在 onStatusChange 上
在我的代码中,您将看到一个按钮和一个可折叠元素。如果单击该按钮,页面将滚动到可折叠状态。 用户点击按钮后是否可以打开折叠?我考虑过使用视口(viewport),但每次在视口(viewport)中时,折
我有一个 Collapsible-set(有 5-10 个可折叠)并使用此代码查找已打开的: $("#mySet").on("collapsibleexpand", function (e) {
我正在使用 jQuery Collapse在通过 Ajax 插入的元素上。 当我应用下面的行时,它删除了 collapse 类。我需要保留该类,以便在需要关闭 Ajax 内容时调用 collapse(
我正在尝试使用 隐藏表格中的列和 visibility:collapse如此处所述: Is it possible to hide / show table columns by changing
我在格式化 nav navbar-nav 无序列表中的列表项时遇到问题。当页面为全尺寸时,我想保留格式不变。但是,我想在页面缩小时格式化/自定义列表项,并且列表项“消失”并且仅在用户单击切换按钮后“重
出于某种原因,即使我第一次执行完全相同的操作,我也无法再次触发显示。 基本上,我有一个表单,用户可以从下拉列表中选择前两个字段(商家提供商和银行)或添加新条目。因此,我在 Javascript 中使用
我使用了 jsfiddle 68RXP 中的示例collapse-group 创建一个可扩展的 div: HTML: Heading Lorem ipsum View
我有以下问题:当我翻译表格中的标题单元格并且表格设置为 border-collapse:collapse 时,单元格将移动但不会移动它们的边框。我创建了一个测试: 标记:
我是 CSS 和 Bootstrap 3.0 的新手。下面是我可以在很多地方找到的代码,现在我可以毫无问题地编写它。但我真的不知道幕后情况如何。 Company
我有一个包含多行的表格,例如: Line1 Line2 Line3 现在,在 javascript(基于单选输入字段)中,我想通过添加 visibility:collapse 来
我有一个网页,我在其中尝试使所有浏览器的边框正确。参见 http://dl.dropbox.com/u/17256431/SpreadsheetConverter/border-3/border-3.
我正在尝试使用 javascript 来创建 Bootstrap 我只需要更新 javascript 文件,而不是在网站的各个页面上管理导航栏。 这是横幅的代码: document.write( "
给定以下 HTML 页面,表格顶部出现一条水平线,其中第一行将包含第二和第三个单元格(如果已定义)。 Test Page table { margin:10px 0 10px 0;
我是一名优秀的程序员,十分优秀!