If you are using javascript, you have the ability to verify whether the event target matches the specific element where you want to implement an effect. If it does, then add a certain class; if not, remove it.
var link = document.querySelectorAll('a.link')[0];
link.addEventListener('mouseover', mouseEnter, false);
link.addEventListener('mouseout', mouseLeave, false);
function mouseEnter(event) {
if(event.target === link) {
link.classList.add('hover');
}
else {
mouseLeave();
}
}
function mouseLeave() {
link.classList.remove('hover');
}
.link.hover {
background: #499a75;
}
<a href="#" class="link">Example Text
<ul>
<li>1</li>
<li>2</li>
</ul>
</a>