I am struggling with transitioning my arrow from › (right) to ˇ (down) when toggled. I can't figure out where to place it.
If you look at Menu 1 > Submenu 1 > Text with hyperlink
I want the 'Text with Hyperlink' to be clickable on the entire box instead of just the word itself.
I'm feeling lost and frustrated. I don't have much knowledge in this area. I hope you understand what I'm trying to achieve. Thank you.
$('.toggle').click(function(e) {
e.preventDefault();
var $this = $(this);
if ($this.next().hasClass('show')) {
$this.next().removeClass('show');
$this.next().slideUp(350);
} else {
$this.parent().parent().find('li .inner').removeClass('show');
$this.parent().parent().find('li .inner').slideUp(350);
$this.next().toggleClass('show');
$this.next().slideToggle(350);
}
});
* {
font-family: "Brandon Bold",Helvetica,Arial,sans-serif !important;
font-size: 15px;
letter-spacing: 0.05em;
}
.accordion {
width: 99%;
padding: 0;
margin: auto;
}
a {
text-decoration: none;
color: inherit;
}
p {
font-size: 1.1em;
margin: 1em 0;
}
.description {
margin: 1em auto 2.25em;
}
ul {
list-style: none;
padding: 0;
}
ul .inner {
padding-left: 1em;
overflow: hidden;
display: none;
}
ul .inner.show {
/*display: block;*/
}
ul li {
margin: 0.3em 0;
}
ul li a.toggle {
display: block;
border-bottom: 1px solid #575757;
color: #000000;
padding: 0.75em;
transition: background 0.3s ease;
}
ul li a.toggle:hover {
color: #fefefe;
background: rgba(0, 0, 0, 0.9);
border-radius: 0.15em;
}
.subnotoggle {
padding: 0.75em 0 0.75em 0.75em;
border-bottom: 1px solid #575757;
}
.toggle::before {
content: '\203A';
font-size: 20px;
float: right;
margin-right: 15px;
}
.notoggle li {
padding: 0.75em 0 0.75em 0.75em;
border-bottom: 1px solid #575757;
}
.notoggle li a {
padding-left: 1.3em;
}
.notoggle li::before {
content: '\2012';
font-size: 15px;
margin-left: 15px;
transform: rotate(90deg);
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
}
.notoggle li:hover::before {
content: '\203A';
font-size: 17px;
transform: rotate(90deg);
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
}
<ul class="accordion">
<li>
<a class="toggle" href="javascript:void(0);">Menu 1</a>
<ul class="inner">
<li>
<a href="#" class="toggle">Sub Menu 1</a>
<div class="inner">
<ul class="notoggle">
<li><a href="#">Text with Hyperlink 1</a></li>
<li><a href="#">Text with Hyperlink 2</a></li>
<li><a href="#">Text with Hyperlink 3</a></li>
</ul>
</div>
</li>
<li>
<a href="#" class="toggle">Sub Menu 2</a>
<div class="inner">
<p>
Children will automatically close upon closing its parent.
</p>
</div>
</li>
<li class="subnotoggle">Sub Menu 3</li>
</ul>
</li>
<li>
<a class="toggle" href="javascript:void(0);">Menu 2</a>
<ul class="inner">
<li>
<a href="#" class="toggle">Sub Menu 1</a>
<ul class="inner">
<li>
<a href="#" class="toggle">Another Sub</a>
<div class="inner">
<p>
As long as the inner element has inner as one of its classes then it will be toggled.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas tempus placerat fringilla. Duis a elit et dolor laoreet volutpat. Aliquam ultrices mauris id mattis imperdiet. Aenean cursus ultrices justo et varius. Suspendisse aliquam orci id dui dapibus
blandit. In hac habitasse platea dictumst. Sed risus velit, pellentesque eu enim ac, ultricies pretium felis.
</p>
</div>
</li>
</ul>
</li>
<li class="subnotoggle">Submenu 2</li>
<li class="subnotoggle">Sub Menu 3</li>
</ul>
</li>
</ul>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script><script src="./script.js"></script>