- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何在打开下拉菜单时在左侧设置箭头图标?默认位置是正确的,但是当单击并打开下拉菜单时,我想在左侧显示图标。看图片示例:
我再举一个例子:
模具统计>
模具统计2 >
:点击 die Stats 或 die Stats2 :
<模具统计
:箭头切换到左边位置:
看我的代码:
<div class="first-lower-div">
<div class="low-lower">
<div class="dropdown">
<button class="dropbtn dropbtn-one">
Staatskunde Grundbegriffe
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
<ul>
<li class="item-has-children">
<a href="#0">Main Item One <span class="rightt"> </span></a>
<ul class="sub-menu">
<li><a href="#">Sub Item One <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Two <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Three <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Four <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Five <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Six <span class="rightt"> </span></a></li>
</ul>
</li>
<div class="hr2"></div>
<li class="item-has-children">
<a href="#0">Main Item Two <span class="rightt"> </span></a>
<ul class="sub-menu">
<li><a href="#">Sub Item One <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Two <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Three <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Four <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Five <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Six <span class="rightt"> </span></a></li>
</ul>
</li>
<div class="hr2"></div>
<li class="item-has-children">
<a href="#0">Main Item Three <span class="rightt"> </span></a>
<ul class="sub-menu">
<li><a href="#">Sub Item One <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Two <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Three <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Four <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Five <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Six <span class="rightt"> </span></a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div class="low-lower">
<div class="dropdown">
<button class="dropbtn dropbtn-two">
Staatskunde Grundbegriffe
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
<ul>
<li class="item-has-children">
<a href="#0">Main Item One <span class="rightt"> </span></a>
<ul class="sub-menu">
<li><a href="#">Sub Item One <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Two <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Three <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Four <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Five <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Six <span class="rightt"> </span></a></li>
</ul>
</li>
<div class="hr2"></div>
<li class="item-has-children">
<a href="#0">Main Item Two <span class="rightt"> </span></a>
<ul class="sub-menu">
<li><a href="#">Sub Item One <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Two <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Three <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Four <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Five <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Six <span class="rightt"> </span></a></li>
</ul>
</li>
<div class="hr2"></div>
<li class="item-has-children">
<a href="#0">Main Item Three <span class="rightt"> </span></a>
<ul class="sub-menu">
<li><a href="#">Sub Item One <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Two <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Three <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Four <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Five <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Six <span class="rightt"> </span></a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div class="low-lower">
<div class="dropdown">
<button class="dropbtn dropbtn-three">
Staatskunde Grundbegriffe
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
<ul>
<li class="item-has-children">
<a href="#0">Main Item One <span class="rightt"> </span></a>
<ul class="sub-menu">
<li><a href="#">Sub Item One <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Two <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Three <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Four <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Five <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Six <span class="rightt"> </span></a></li>
</ul>
</li>
<div class="hr2"></div>
<li class="item-has-children">
<a href="#0">Main Item Two <span class="rightt"> </span></a>
<ul class="sub-menu">
<li><a href="#">Sub Item One <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Two <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Three <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Four <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Five <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Six <span class="rightt"> </span></a></li>
</ul>
</li>
<div class="hr2"></div>
<li class="item-has-children">
<a href="#0">Main Item Three <span class="rightt"> </span></a>
<ul class="sub-menu">
<li><a href="#">Sub Item One <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Two <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Three <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Four <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Five <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Six <span class="rightt"> </span></a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
Javascript:
const links = document.querySelectorAll(".item-has-children");
links.forEach((link) => {
link.addEventListener('click', (e) => {
if (e.target.nextElementSibling.classList.contains('selected')) {
e.target.nextElementSibling.classList.remove('selected')
} else {
e.target.nextElementSibling.classList.add('selected')
}
})
})
CSS:
.section-two {
padding: 0 30px;
.header-holder {
display: flex;
justify-content: center;
padding: 40px 0px;
h3 {
font-size: 30px;
font-family: 'Replica Regular', Arial, sans-serif;
font-weight: 600;
color: #666;
}
}
.wrapper-two {
display: flex;
flex-direction: column;
.first-div-holder {
background: brown;
display: flex;
flex-direction: column;
}
.first-lower-div {
display: flex;
justify-content: space-around;
.low-lower {
p {
color: white;
}
}
@media (max-width: 980px) {
flex-direction: column;
align-items: center;
width: 100%;
}
}
.second-lower-div {
text-align: center;
padding: 150px;
h1 {
font-size: 80px;
color: white;
}
h4 {
font-size: 30px;
margin-top: -50px;
color: white;
}
}
.third-lower-div {
display: flex;
margin-bottom: 30px;
text-align: right;
justify-content: center;
justify-content: space-evenly;
.bottom-lower {
display: flex;
align-content: center;
&:nth-child(1),
&:nth-child(2),
&:nth-child(3),
&:nth-child(4) {
display: flex;
align-items: center;
color: white;
}
}
p {
color: white;
font-weight: 600;
font-size: 16px;
margin: 0 10px;
}
@media (max-width: 700px) {
flex-direction: column;
align-items: center;
width: 100%;
}
}
.second-div-holder {
background: #f1f1f1;
.second-div-holder-div {
display: flex;
flex-wrap: wrap;
justify-content: center;
padding: 15px;
.div-column {
flex: 1;
min-width: 30%;
padding: 25px;
overflow: hidden;
// for small device
// flex: 0 0 100%;
// max-width: 100%;
@media (max-width: 600px) {
min-width: 100%!important;
}
@media (max-width: 1000px) and (min-width: 600px) {
min-width: 50%!important;
}
.div-column-first {
height: 210px;
img {
height: 100%;
width: 100%;
object-fit: cover;
}
#first-child-image {
border-bottom: 5px solid blue;
}
#second-child-image {
border-bottom: 5px solid red;
}
#third-child-image {
border-bottom: 5px solid yellow;
}
}
.div-column-second {
padding: 40px;
background: white;
text-align: center;
}
}
}
}
}
}
.dropdown {
position: relative;
display: inline-block;
.dropbtn {
background-color: blue;
color: white;
font-size: 17px;
font-weight: 600;
border: none;
cursor: pointer;
height: 55px;
background: #153161;
border-bottom-left-radius: 7px;
border-bottom-right-radius: 7px;
padding: 12px 50px;
i {
margin-left: 30px;
color: #8391ab;
}
.arrow {
width: 0;
height: 0;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid #8191aa;
margin: 100%;
padding-top: 4px;
z-index: 999;
}
}
.dropbtn-two {
background: red;
}
.dropbtn-three {
background: yellow;
}
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
width: 330px;
z-index: 999;
a {
color: black;
padding: 12px 25px;
text-decoration: none;
display: flex;
justify-content: flex-start;
width: 100%;
&:hover {
background-color: #F8F8F8
}
}
.rightt {
display: inline-block;
// width: 9px;
// height: 9px;
cursor: pointer;
// padding-left: 180px;
position: absolute;
right: 20px;
top: 50%;
transform: translateY(-50%);
z-index: 999;
&:after {
content: '';
display: inline-block;
width: 9px;
height: 9px;
border-top: 0.2em solid #ababab;
border-right: 0.2em solid #ababab;
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
}
.left {
display: inline-block;
// width: 9px;
// height: 9px;
cursor: pointer;
// padding-left: 180px;
position: absolute;
right: 20px;
top: 50%;
transform: translateY(-50%);
z-index: 999;
&:after {
content: '';
display: inline-block;
width: 29px;
height: 29px;
border-top: 0.2em solid #ababab;
border-right: 0.2em solid #ababab;
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
}
.item-has-children {
a {
position: relative;
}
}
}
.dropdown:hover .dropdown-content {
display: block;
background: white;
opacity: 0.8;
width: 100%;
}
.hr2 {
height: 1px;
background: #ccc;
border-bottom: 1px solid #fff;
border-top: 1px solid #ccc;
}
.sub-menu {
display: none;
}
.sub-menu.selected {
display: flex;
flex-direction: column;
transition: transform 0.6s;
}
ul {
list-style: none;
padding: 0 5px;
width: 100%;
height: 100%;
}
const links = document.querySelectorAll(".item-has-children");
links.forEach((link) => {
link.addEventListener('click', (e) => {
if (e.target.nextElementSibling.classList.contains('selected')) {
e.target.nextElementSibling.classList.remove('selected')
} else {
e.target.nextElementSibling.classList.add('selected')
}
})
})
.dropdown {
position: relative;
display: inline-block;
.dropbtn {
background-color: $facebookBlue;
color: $white;
font-size: 17px;
font-weight: 600;
border: none;
cursor: pointer;
height: 55px;
background: #153161;
border-bottom-left-radius: 7px;
border-bottom-right-radius: 7px;
padding: 12px 50px;
i {
margin-left: 30px;
color: #8391ab;
}
.arrow {
width: 0;
height: 0;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid #8191aa;
margin: 100%;
padding-top: 4px;
z-index: 999;
}
}
.dropbtn-two {
background: $strongRed;
}
.dropbtn-three {
background: $strongYellow;
}
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
width: 330px;
z-index: 999;
a {
color: black;
padding: 12px 25px;
text-decoration: none;
display: flex;
justify-content: flex-start;
width: 100%;
&:hover {
background-color: #F8F8F8
}
}
.rightt {
display: inline-block;
// width: 9px;
// height: 9px;
cursor: pointer;
// padding-left: 180px;
position: absolute;
right: 20px;
top: 50%;
transform: translateY(-50%);
z-index: 999;
&:after {
content: '';
display: inline-block;
width: 9px;
height: 9px;
border-top: 0.2em solid #ababab;
border-right: 0.2em solid #ababab;
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
}
.item-has-children {
a {
position: relative;
}
}
}
.dropdown:hover .dropdown-content {
display: block;
background: white;
opacity: 0.8;
width: 100%;
}
.hr2 {
height: 1px;
background: #ccc;
border-bottom: 1px solid #fff;
border-top: 1px solid #ccc;
}
.sub-menu {
display: none;
}
.sub-menu.selected {
display: flex;
flex-direction: column;
transition: transform 0.6s;
}
ul {
list-style: none;
padding: 0 5px;
width: 100%;
height: 100%;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/sass.js/0.11.0/sass.min.js" integrity="sha256-1MTlXahXbxCpbv9RxO9Qx96oBa3f1cEXH0GU4AS+TU0=" crossorigin="anonymous"></script>
<div class="dropdown">
<button class="dropbtn dropbtn-one">
Staatskunde Grundbegriffe
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
<ul>
<li class="item-has-children">
<a href="#0">Main Item One <span class="rightt"> </span></a>
<ul class="sub-menu">
<li><a href="#">Sub Item One <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Two <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Three <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Four <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Five <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Six <span class="rightt"> </span></a></li>
</ul>
</li>
<div class="hr2"></div>
<li class="item-has-children">
<a href="#0">Main Item Two <span class="rightt"> </span></a>
<ul class="sub-menu">
<li><a href="#">Sub Item One <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Two <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Three <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Four <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Five <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Six <span class="rightt"> </span></a></li>
</ul>
</li>
<div class="hr2"></div>
<li class="item-has-children">
<a href="#0">Main Item Three <span class="rightt"> </span></a>
<ul class="sub-menu">
<li><a href="#">Sub Item One <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Two <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Three <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Four <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Five <span class="rightt"> </span></a></li>
<div class="hr2"></div>
<li><a href="#">Sub Item Six <span class="rightt"> </span></a></li>
</ul>
</li>
</ul>
</div>
</div>
最佳答案
你可以用这个CSS:
.sub-menu.selected .rightt {
float:left; // to shift to left
transform: rotate(180deg); to rotate the icon
}
或使用边距或使用相同的技术进行变换
关于javascript - 打开下拉菜单时如何在正确位置反转箭头图标? Javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56868783/
我正在尝试将我在本文档中阅读的内容付诸实践: https://sar.informatik.hu-berlin.de/research/publications/SAR-PR-2006-05/SAR-
我一直在尝试编写一个可以改变这个的 terraform 表达式: subnets = { my_subnet_1 = { nsg = "my_nsg_1", ad
我有一个HashMap,它将两个字符串转换为单词,然后将单词添加到 map 中。我拥有它,以便一个键可以指向多个值。现在我想创建一个循环来反转表,以便所有值都指向键。不要为一个指向多个逆值的键而烦恼。
我对 ~ 运算符有点困惑。代码如下: a = 1 ~a #-2 b = 15 ~b #-16 ~ 是如何工作的? 我想,~a 会是这样的: 0001 = a 1110 = ~a 为什么不呢? 最佳
如果执行 ResourceManager.GetString(Key),您可以获取资源中某个项目的值。有没有一种方法可以进行反向查找以从给定值的资源中获取 key (本质上是反翻译)? 最佳答案 您应
我在 R 中编写了一个代码来反转一个数字。但是我得到了 inf作为输出。 digit0){ rev_num=rev_num*10 + digit %% 10 digit=digit / 10 }
这个问题已经有答案了: Invert keys and values of the original dictionary (3 个回答) 已关闭 9 年前。 我正在寻找在 python 上转置一本字
所以我试图反转我当前制作的形状的输出。我想知道我应该扭转这种情况吗?我尝试更改变量“a”和“c”的值,最终陷入无限循环。 class IRT { public static void main
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: PHP mysql_real_escape_string() -> stripslashes() leavi
从 Wordpress 模板中提取一些预先存在的代码来绘制椭圆阴影。阴影呈椭圆形向下辐射。只有椭圆的下半部分可见,从而形成底部阴影效果。 我只是想“反转”椭圆的“阴影效果”,以便只有阴影的顶部 一半可
我有一个函数应该找到两个弧度的中间 function mrad(rb,ra){return (rb+ra)/2;} 但有时,当我用 Math.sin 和 Math.cos 绘制 x 和 y 时,这两个
给定此代码(http://jsfiddle.net/bzf1mkx5/) .intern { -webkit-animation: in 1s 1 reverse forwards; } .i
我对 ~ 运算符有点困惑。代码如下: a = 1 ~a #-2 b = 15 ~b #-16 ~ 是如何工作的? 我想,~a 会是这样的: 0001 = a 1110 = ~a 为什么不呢? 最佳
我需要以相反的顺序从列表中提取项目(从最后一个条目到第一个)。我设法得到了所有元素,但是,从第一个到最后一个。这是我正在使用的部分代码: 该列表位于不同的网站集上。 using (SPSit
由于一些证书问题,我不得不写 ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chai
是否有一个函数接受一个函数列表和一个输入,并输出一个对输入进行操作的函数列表? 所以像 map,但倒退: >>>map(lambda x: 2*x,[1,2,3,4,5,6,7,8,9]) [2, 4
考虑下表团队消息: 15:10 | Peter | I'm off to the store, call my mobile phone if you need me. 15:11 | Susy |
算法如下: int encryption(int a, int b) { short int c, c2; uint8_t d; c = a ^ b; c2 = c;
我正在寻找一种方法来逆转 a CRC32 checksum .周围有解决方案,但它们要么是 badly written , extremely technical和/或 in Assembly .汇编
使用批处理文件,处理所有在文件名或扩展名中共享字符串的文件就足够简单了,例如: FOR /R %F IN (*.EXE) DO @ECHO %F 但是,如果我想反转文件集的含义怎么办?比如,处理所有不
我是一名优秀的程序员,十分优秀!