- 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/
这个问题已经有答案了: How to do case insensitive string comparison? (23 个回答) 已关闭 3 年前。 用户在我的输入栏中写入“足球”,然后执行第 6
啊,不习惯 javascript 中的字符串。 character_id= + id + correct= + correctOrIncorrect 这就是我需要制作成字符串的内容。如果您无法猜测字符
$(function() { var base_price = 0; CalculatePrice(); $(".math1").on('change', function(e) { Calc
我找不到任何文章回答问题:将Spinnaker部署到Spinnaker将管理的同一Kubernetes集群是否安全/正确?我主要是指生产,HA部署。 最佳答案 我认为Spinnaker和Kuberne
我正在使用MSVC在Windows上从源代码(官方源代码发布,而不是从仓库中)构建Qt5(Qt 5.15.0)。 我正在设置环境。变量,依赖项等,然后运行具有1600万个选项的configure,最后
我需要打印一个包含重复单词的数组。我的数组已经可以工作,但我不知道如何正确计算单词数。我已经知道,当我的索引计数器 (i) 为 49 时,并且当 (i) 想要计数到 50 时,我会收到错误,但我不知道
我正在遵循一个指南,该指南允许 Google map 屏幕根据屏幕尺寸禁用滚动。我唯一挣扎的部分是编写一个代码,当我手动调整屏幕大小时动态更改 True/False 值。 这是我按照说明操作的网站,但
我有一个类“FileButton”。它的目的是将文件链接到 JButton,FileButton 继承自 JButton。子类继承自此以使用链接到按钮的文件做有用的事情。 JingleCardButt
我的 friend 数组只返回一个数字而不是所有数字。 ($myfriends = 3) 应该是…… ($myfriends = 3 5 7 8 9 12). 如果我让它进入 while 循环……整个
这个问题在这里已经有了答案: Is there a workaround to make CSS classes with names that start with numbers valid?
我正在制作一个 JavaScript 函数,当调整窗口大小时,它会自动将 div 的大小调整为与窗口相同的宽度/高度。 该功能非常基本,但我注意到在调整窗口大小时出现明显的“绘制”滞后。在 JS fi
此问题的基本视觉效果可在 http://sevenx.de/demo/bootstrap-carousel/inc.carousel/tabbed-slider.html 获得。 - 如果你想看一看。
我明白,如果我想从函数返回一个字符串文字或一个数组,我应该将其声明为静态的,这样当被调用的函数被返回时,内容就不会“消亡”。 但我的问题是,当我在函数内部使用 malloc 分配内存时会怎样? 在下面
在 mySQL 数据库中存储 true/false/1/0 值最合适(读取数据消耗最少)的数据字段是什么? 我以前使用过一个字符长的 tinyint,但我不确定它是否是最佳解决方案? 谢谢! 最佳答案
我想一次读取并处理CSV文件第一行中的条目(例如打印)。我假设使用Unix风格的\n换行符,没有条目长度超过255个字符,并且(现在)在EOF之前有一个换行符。这意味着它是fgets()后跟strto
所以,我们都知道 -1 > 2u == true 的 C/C++ 有符号/无符号比较规则,并且我有一种情况,我想有效地实现“正确”比较。 我的问题是,考虑到人们熟悉的尽可能多的架构,哪种方法更有效。显
**摘要:**文章的标题看似自相矛盾。 本文分享自华为云社区《Java异常处理:如何写出“正确”但被编译器认为有语法错误的程序》,作者: Jerry Wang 。 文章的标题看似自相矛盾,然而我在“正
我有一个数据框,看起来像: dataDemo % mutate_each(funs(ifelse(. == '.', REF, as.character(.))), -POS) # POS REF
有人可以帮助我使用 VBScript 重新格式化/正确格式化带分隔符的文本文件吗? 我有一个文本文件 ^分界如下: AGREE^NAME^ADD1^ADD2^ADD3^ADD4^PCODE^BAL^A
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
我是一名优秀的程序员,十分优秀!