Make div appear on Hover
-
Hello, I was trying to make a text appear when I hover on a picture, I could achieve that by using the JS code:
<script>
jQuery(document).on("mouseenter", ".hoverme", function(event) {
jQuery(".showme").show();
});
jQuery(document).on("mouseleave", ".hoverme", function(event) {
jQuery(".showme").hide();
});
</script>it works fine but the only problem is that the element with class .showme is visible when I load the page, then If I hover the other element and take off the mouse it disappear.
how can I make the element "showme" invisible when I first load the page?
thank you! -
Dear @beshepappà
you can use CSS classes to hide and remove the elements.Or call the function to hide ALL before you click.
Best!
Marius
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it