When loading elements into a div using the load() function, I noticed that the :hover effect in CSS stops working for those elements.
It's a dynamic menu setup, as shown below:
<div id='main-menu'>
<ul>
<li class='click-me hover-me'></li>
</ul>
</div>
<div id='alternative-menu'>
</div>
Then I load a new menu into the alternative menu and hide the old one in JavaScript:
$(document).on('click', '.click-me', function(){
$('#alternative-menu').load('newmenu.php', function(){$('#main-menu').hide();});
});
The HTML code for the new menu looks like this:
echo "
<ul>
<li class='click-me hover-me'></li>
</ul>";
In my CSS, I have defined:
.hover-me{
font-size:12px;
}
.hover-me:hover{
background-color:#eeeeee;
}
Do you have any suggestions on how to resolve this issue?