Displaying a profile hover card allows users to easily discover and choose whether to follow or explore

I created a profile hover card on my website with a follow/unfollow button. However, I encountered an issue - the hover card disappears when I move away from my profile thumbnail. How can I fix this so that the hover card stays visible on mouseover and disappears on mouseout?

https://i.sstatic.net/QvZ0V.png

Here is the Plunker link

Update: I have found a solution and updated the Plunker for future reference.

Answer №1

It seems like you're using a JS hover event to add/remove the HTML, causing it to disappear when you move off the thumbnail. To prevent this, consider making the hover card a child element of the profile thumbnail and use CSS to show/hide on hover instead of adding/removing the HTML with JS. This way, even when you move over to the card element, you're still technically hovering over the thumbnail element.

Answer №2

When you hover over the circular image, your card will disappear because of the

(mouseout)="hideprofile(d)"
attached to it. This means that once your mouse moves away from the image, the card will be hidden. To improve this behavior, it's recommended to consider hiding the card on a click or based on another condition instead.

One way to address this issue is by adjusting the functionality so that the card only disappears when clicked. Additionally, to ensure that multiple cards are not displayed simultaneously, the

this.data.map(item => { item.showpop = false })
has been incorporated into the showprofile() method to hide all other cards.

For a demonstration of this updated approach, you can view the example provided at https://plnkr.co/edit/MBROv0KeK4BNv0xv

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

Is there a way to determine if a parent of my HTML element possesses a CSS class?

Looking at this HTML code snippet - <div id="parent" class="foo"> <div id="child"> </div> </div> Is there a way to create a test to verify if the child element is utilizing the foo class? I attempted: element .children("#chi ...

Encasing event handler callback within Observable pattern

I am currently exploring how to wrap an event callback from a library to an RxJS Observable in a unique way. This library I am working with sets up handlers for events like so: const someHandler = (args) => {}; const resultCallback = (result) => {} ...

Is it possible to create a transparent colored foreground in HTML?

Looking to create a translucent foreground color on a webpage? I'm aiming to give a hint of red to the overall look of the website. Edit: Just to clarify, I am not referring to changing font colors. I want a color that can overlay the entire page wit ...

Is it feasible to create a set of standardized values for an array's properties?

My goal is to restrict the values for a property (or react props in this case) based on the values provided in another property. Firstly, I have my Option interface: interface Option { value: string; label: string; } Next, I define my SelectInputProp ...

Do not include the node_modules directory in the TypeScript compilation process, except for a specific subdirectory that is

To exclude the entire node_modules directory from TypeScript compilation, you can modify the tsconfig.json file like so: { "compilerOptions": { "module": "commonjs", "sourceMap": true, "target": "es6" }, "exclude": [ ...

The Child Component encountered difficulties in connecting to the EventEmitter via the service

In the code snippet below, we have the Subscribing Component "pop-list.component.ts" : import { Component, OnInit } from '@angular/core'; import { ChildCommService } from '../child-comm.service'; @Component({ selector: 'app-pop- ...

What steps can I take to design a functional hamburger menu?

After multiple attempts to create a hamburger menu, I have hit a roadblock. Clicking on the menu icon transforms it into an 'X', but unfortunately, it does not trigger the opening of the menu. Despite days of effort and research, I have yet to fi ...

Error Alert: Redundant Identifier in Angular 2 TypeScript Documents

After following the Angular2 TS Quickstart guide, I noticed duplicate files scattered across various folders in my project. For browser: typings/browser node_modules/angular2/typings/browser Regarding es6-shim: node_modules/angular2/typings/es6-shi ...

Tips for displaying a modal pop up on top of another modal pop up

Recently, I encountered an issue with my Modal Pop Up. After clicking on a button within the Modal Pop Up, a second Modal Pop Up appeared but was partially hidden behind the first one. I am now seeking advice on how to ensure that the second Modal Pop Up d ...

Arrangements of inputs in HTML

<input name="foo[]" ... > While I have utilized these in the past, I am curious about its official name and whether there is a specific specification for it. Despite my search efforts within the HTML 4.01 Spec, the term "array" seems to be most com ...

Guide to Modifying the Parameter Value in JMeter's "Http Request" for a checkbox with "title" text managing the state

In the HTML code, there is a checkbox element that initially has the title "Select all rows in this table": <input type="checkbox" class="form-checkbox" title="Select all rows in this table"> Upon inspection, the title ...

Angular 2 ngIf displaying briefly before disappearing

Encountering a strange issue with an Angular 2 ngIf statement where it appears on the page for a brief moment and then disappears. The content is visible, but it doesn't remain on the page. I suspect it might be related to some asynchronous behavior. ...

Bootstrap grid. Instead of moving to the next row, scroll horizontally when the content overflows

Here is the code snippet: <div class="row shochatgroup"> <div *ngFor="let message of messages" class="col-auto"> <button *ngIf="message.state.attributes.shochatpaid > 0 && message.state.at ...

error related to reserved area in jquery message box

Currently, I am exploring a jQuery message box similar to the one featured in this example. While I am eager to integrate it into my web application, I have run into an issue. Specifically, I am facing a problem with the reserved area of the entire popup. ...

Encountering a reference type error when using drag and drop with NextJS and react-dnd

When using react-dnd version 16 with TypeScript in Next.js, the refs within the return array of the useDrag and useDrop hooks are not compatible with LegacyRef. Interestingly, other platforms like Vite.Js handle this type assignment correctly. The same co ...

In this guide, we will explore the process of designing unique styles for ng

What is the proper way to customize CSS for a specific element? &.ng-select-focused { &:not(.ng-select-opened) > .ng-select-container { border-color: $ng-select-highlight; box-shadow: $ng-select-box-shadow; } } The offi ...

Is it recommended to run JavaScript functions obtained from REST APIs?

Our single page application is built on Angular 4 and we are able to change input fields based on customer requirements. All the business rules for adjusting these fields are coded in JavaScript, which runs on the Java Platform and delivers the output thro ...

Looking for assistance with HTML/CSS code

Adding the code snippet below into my Shopify product-liquid file caused chaos on the page, altering the font and even changing the shape of the add to cart button... The problematic code is shown below: <div id="shopify-section-product-icon-gallery" ...

Retrieve the data in JSON format including the child elements from a PostgreSQL

I have data from a table in Postgres that I need to be returned in Json format with its children properly ordered. So far, I haven't found a solution to achieve this. Is there a way in PostgreSQL to order the parent modules along with their child modu ...

What is the rationale behind an Angular component needing to duplicate an object provided by a service?

As I dive into the HttpClient page within the Angular Fundamentals section, one question that comes to mind is why does the component need to clone the object received from the service handling the HTTP calls? In particular, the code block from the config ...