Fade in and out effect applied to user menu upon hovering

I'm working on creating user menus that have a fade in and out effect when hovering over an icon. However, I want the menu to remain visible if the user hovers over it or the image within it. Below is my code snippet along with a jsfiddle demo: http://jsfiddle.net/anschwem/7mrM2/

<style>
div.notif
{
    display:none;
    position:absolute;
    border:solid 1px black;
    padding:8px;
    background-color:white;
}
a.notif:hover + div.notif
{
    display:block;

}
div.notif:hover
{
    display:block;

}
</style>
<script type='text/javascript'>//NOT WORKING
$(window).load(function(){
$(document).ready(function()
{    
    $(".notif").hover(
      function () {
        $('.notif').fadeIn('slow');
      }, 
      function () {
        $('.notif').fadeOut('slow');
      }
    );
});
});//]]>  
</script>//NOT WORKING
</head>
<body>
<a class="notif" href="notifications.html" style="text-decoration:none;"><img src="images/bubble.png" style="position:relative; top:20px;"/></a>
    <div class="notif" style="z-index:999999; ">
<a href="notifications.html"><img src="images/notif.png"/></a>
</body>

Answer №1

Use this resource to aid you. Explore the JSFiddle demonstration

Markup Language (HTML)

<div class='parent'>
   <a class="notif" href="notifications.html" style="text-decoration:none;"><img src="http://upload.wikimedia.org/wikipedia/commons/a/ac/Approve_icon.svg" height="30" width="30"/></a>

   <div class="notif" style="z-index:999999; ">
      <a href="notifications.html"><img src="http://doinghistoryproject.tripod.com/sitebuildercontent/sitebuilderpictures/failure-message.gif" height="80" width="80"/></a>
   </div>
</div>

JavaScript (JS)

$(document).ready(function () {
    $(".parent").hover(
    function () {
       $(this).find('div.notif').stop().fadeIn('slow');
    },
    function () {
       $(this).find('div.notif').stop().fadeOut('slow');
    });
});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for getting free jqgrid to display frozen column borders in the search toolbar

If the actions column has a caption of "Activity" or custom settings and is frozen, the free jqgrid will not display column borders for this column in the search toolbar. Vertical lines do not appear in the search toolbar: Is there a way to resolve this ...

Keep the columns at a full 100% height while accommodating dynamic content

Is it possible to have a two-column layout, where one column remains static while the other dynamically generates content, while ensuring both columns are 100% the height of the wrapper? https://jsfiddle.net/t1h4vngv/1/ HTML <div class="wrapper"> ...

Utilize a Downloaded Image as a BLOB for the Background in Angular

I recently downloaded a BLOB that happens to be an image file. I've been trying to set it as the background of my webpage, but all the tutorials I came across show BLOBs as URLs. The object I downloaded looks something like this (Logged the downloaded ...

A guide on displaying an array object in a table column using Vue.js and Element UI

Having issues with rendering array data in Vue Js Element UI using the el-table-column element. The string data displays correctly, but I'm facing problems with the array data. I've attempted to include static data within the data() return method ...

Adapt the size of HTML video tags based on the width of the screen and level of

Within the site (developed with React, utilizing Typescript and Tailwind), there exists a component that allows users to watch videos (constructed using the HTML Video tag). Additionally, beneath the video, there are various dropdowns and buttons. However, ...

Creating a custom JavaScript function from a third-party source to mimic the behavior of an Angular2 HTTP request asynchronously

Currently, I am utilizing the AWS-SDK to facilitate the upload of images to an S3 bucket. The reason behind this choice is the absence of an Angular4 library tailored for this specific task as far as my understanding goes. The code snippet showcasing the f ...

What is the best way to position a sticky element on top of an image?

When designing my website, I encountered an issue with a "sticky element" and a series of images below it. As I scroll down, the "sticky element" ends up hiding behind the images, making it invisible. I'm seeking a solution to keep the "sticky element ...

Launch the game within the gaming application

I am looking to incorporate a game within another game... Here's what I mean: Open the app: Pandachii Next, navigate to the 4th button (game pad). When we click on the game icon, I want to launch another game (located below the Pandachii window - c ...

Unexpected behavior observed when animating CSS transform in IE

I am currently facing an issue with a CSS animation on my website that animates an arrow back and forth. The animation is working perfectly on all browsers except for Internet Explorer, where there seems to be a glitch causing the Y position of the arrow t ...

Update a parent page section with new content once a child modal popup is closed

I've hit a roadblock with this problem and despite trying several solutions, I can't seem to get it right. Within my MVC6 view, there are multiple partials. One of the partials contains an anchor tag: @model ModelA <div> @Html.TextBoxF ...

Instructions for securing a React Front End with Node.js Express-Sessions authentication:

I have decided to move away from using Firestore auth in order to develop my own authentication system. Here is my goal: To create a React web app that allows users to sign up and sign in. Authenticated users should be able to interact with a REST API, w ...

Error loading wc_print_notices to fix WooCommerce login or registration form

Coding the woocommerce login and register forms within a popup element has been successful. By incorporating <?php wc_print_notices(); ?> into the popup, error messages are displayed as needed. The main challenge now is to display the appropriate for ...

Updating the DOM after making changes with Maquette involves calling the `renderMaquette

In a previous discussion, I expressed my desire to utilize Maquette as a foundational hyperscript language. Consequently, avoiding the use of maquette.projector is essential for me. However, despite successfully appending SVG objects created with Maquette ...

Moving from traditional web pages to a mobile application using NextJS has brought about the error "rest.status is

Currently, I am in the process of upgrading from Next 13.2.5 to version 14.1.0 and switching to using app/api/example/route.js instead of pages/api/example.js. After making these changes, I encountered an error stating TypeError: res.status is not a funct ...

Swap two frames effortlessly with just a single click!

Is there a way to effortlessly change the contents of two frames with just one click? With a single click, I'd like to modify both "framename" and "framename2" by setting their href attribute to 'qwerty' and 'qwerty2' respectively ...

Using the # symbol alongside other characters or numbers may prevent Reg Ex from validating

I am asking the same question again as I did before. I apologize, but I have checked all the links provided and they were not helpful. Also, this is my first time asking a question here so I was not very clear on how to ask. Here are the details of my iss ...

Changing json into another format

I am struggling with a JSON data format issue. I have tried using Object.values and object.keys along with Array.prototype.map(), but my algorithm is not producing the desired outcome. [ { "2018-01-01": [ { "firstname": "mati", "lastname": "mati ...

Remove the class upon clicking

I recently created a toggle-menu for my website that includes some cool effects on the hamburger menu icon. The issue I am facing is that I added a JavaScript function to add a "close" class when clicking on the menu icon, transforming it into an "X". Whil ...

Adding functions to the prototype of a function in JavaScript

Is there a more concise way to simplify this code snippet? var controller = function(){ /*--- constructor ---*/ }; controller.prototype.function1 = function(){ //Prototype method1 } controller.prototype.function2 = function(){ //Prototyp ...

By utilizing JavaScript/jQuery, you can validate URLs to ensure they begin with either http or https and include

Looking for guidance on how to validate a URL with either http or https and www included. Appreciate it, Amit ...