I've encountered a straightforward issue - I have an anchor in a navigation menu that generates an arrowhead character as ::after pseudo content in CSS when hovering over it:
https://i.sstatic.net/Yhd9A.jpg
However, the arrowhead character disappears when moving the mouse away and then hovering on a different anchor in the dropdown menu below it:
https://i.sstatic.net/zOdbZ.jpg
Below is the basic CSS used to achieve the hover effect:
.nav > li.dropdown > a:hover:after {
display: block;
position: relative;
top: 2px;
width: 100%;
text-align: center;
content: "\25B2";
color: #ccc;
}
ul.dropdown-menu > li > a:hover {
padding: 10px 15px;
color: #0096d6;
}
Since this is a common navigation technique, I am looking for a way to use Javascript to keep the ::after content displayed on the top anchor when interacting with a separate anchor in the dropdown menu below it. jQuery cannot access ::after elements as they are not part of the DOM. However, some examples show creating ::after content by adding style tags to document heads in pure Javascript, though I'm unsure if this will solve my issue. Is there a method where hovering over one element can trigger the ::after content of another element using Javascript? Thank you for any assistance you can provide.
UPDATE: Here is a relevant HTML snippet as requested. I have also updated the CSS above to reflect the dropdown hover state.
<ul class="nav navbar-nav">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Tools and Information</a>
<ul class="dropdown-menu">
<li><a href="/foo">Print Permanence</a></li>
<li><a href="/foo2">Another Link</a></li>
</ul>
</li>
</ul>