Reveal concealed content when hovering over it

Is there a way to make a hidden div with a button visible when hovering over the 'person-wrap' div? Should I rely on CSS tricks or utilize JQUERY for this task?

You can check out the JSFIDDLE example here: http://jsfiddle.net/ceTdA/3/

The desired div appearance:

#buttons {
display: none;
    position:absolute;
    right:10px;
    top:10px;
margin: 0px 0px 0px 0px;
height: 30px;
width: 225px;
overflow: auto;
 }

Answer №1

To achieve this effect where the #buttons div appears when hovering over the #person-wrap parent div, you can use CSS only:

#person-wrap:hover #buttons {
    display : block;
}

Check out the live demonstration here: http://jsfiddle.net/ceTdA/4/

Answer №2

Give this code a shot:

$("#person-wrap").hover(function() {
    $(this).find('#buttons').show();
}, function() {
    $(this).find('#buttons').hide();
});

Answer №3

SSomeone named nnnnnn recommends a purely CSS approach as the best method, but using jQuery is also quite simple. All you need to do is trigger the first function when hovering over the mouse and the second when the mouse moves away.

$("#person-wrap").hover(
    function () {
        $("#buttons").addClass("hover");
},
    function () {
        $("#buttons").removeClass("hover");
});

Here's a simple CSS code snippet:

.hover{
    display:inline;
}

Answer №4

Include the following CSS:

#profile-pic:hover #buttons{
     display:inline;
} 

See it in action on this jsfiddle

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

Exploring the World of Images with Javascript

I'm currently working on creating a slideshow using HTML and JavaScript. My goal is to have the image change each time I press a button that I've established (see code below). After reviewing my code multiple times, I still can't figure out ...

React JS server conditional response malfunctioning

I've been facing issues with receiving a conditional response from an Express server for a React application. Check out the server-side code below: app.get('/api/checklogin', (req, res) => { var val = req.session.user ? false : tru ...

Deleting all JSON files in a directory using NodeJs

Is there a way to delete only the json files within a directory (multiple levels) without specifying each file name individually? I thought fs-unlinkSync(path) might work, but I haven't found that solution yet. I attempted to use the following method ...

Display a division upon clicking a hyperlink with a specific class

My goal is to display/fade in a <div> with an ID of "signInHold" when the <li> "Sign In" is clicked, utilizing the class signInActive on the <li>. <ul class="nav1"> <li class="nav2"> <a href="http://rocketcss.c ...

Combining Express and React for seamless email sending functionality

Attempting to merge a React.js form with a backend setup using Express to send emails. Uncertain of the proper way to format the form body or which HTTP request method to utilize. React.js and Express.js are located in separate directories. express-mailer ...

Ways to extract JSON data from a promise

Snippet: fetch(`https://api.flickr.com/services/rest/?&method=flickr.photos.search&api_key=++++++++++&tags=obama&format=json&extras=url_m&nojsoncallback=true`, { method: "GET", headers : { 'Content-Type': & ...

The internal style and script specified within the <head> section are not being rendered

Within my Joomla website using the T3 template, I inserted the following "Custom Code" just before the closing </head> tag: <style type="text/stylesheet"> div.t3-sidebar.t3-sidebar-right{ background: #F8F8F8 none repeat scroll 0% 0%; ...

Tactics for postponing a js function post-click

I need to implement a delay after clicking a button to fetch some data. The code will be executed within the browser console. $(pages()) is used to retrieve the pagination buttons. let calls = []; for (let i = 1; i <= callPagesCount; i++) { ...

The expiration of an Ajax session

Scenario : In my web application, there is a password protection mechanism in place. When a http request is made to the server, it is checked against session existence. If the session has expired, the user is directed to the login page. This works well fo ...

Having trouble sending eval to JavaScript function

I have the following image button inside a gridview: <asp:TemplateField HeaderText="Edit" ControlStyle-CssClass="smallTxt" HeaderStyle-CssClass="smallTxt"> <ItemTemplate> ...

Is there a way to pass a c struct pointer into javascript using ffi?

I need help passing a pointer to a struct to a method in nodejs using ffi. I am encountering an error where the type of the JavaScript struct I created cannot be determined. How can I resolve this issue? Previously, I was able to successfully implement si ...

Guide on connecting an Express v4 server with Socket.io 1.3.2 to share a session

For the past few days, I've been struggling to share an express session with socket.io. My setup includes express 4.11.1 and socket.io 1.3.2, along with other dependencies like express-session 1.10.1, cookie-parser 1.3.3, and body-parser 1.10.2. Essen ...

Creating a vertical slider with an unordered list

Looking to create a vertical menu with a fixed height that smoothly slides up and down when the arrow buttons are clicked. I'm struggling to figure out how to properly use offsets to determine where to navigate to. Right now, I am using the relative ...

Every time I try to access my website, all I see is the WordPress installation process page

After initially hosting a WordPress website, I made the decision to switch over to SPIP. However, when attempting to access the site on my laptop, it continues to bring up the WordPress installation process. Interestingly enough, the website appears to lo ...

Creating a unique CSS/HTML Table showcasing varying cell sizes

Can anyone provide guidance on creating a table with various sized cells in HTML/CSS? I find traditional table formatting to be too rigid for this project. Any advice or suggestions would be greatly appreciated! ...

Utilize CSS with dynamically created elements

I am currently figuring out how to use my .each() function with a $(document).ready and a click event. Here's what I have so far: $(document).ready(function(){ $(".help-inline").each(function() { $(this).css('display', 'none&apos ...

The logs of both the frontend and backend display an array of numbers, but surprisingly, this data is not stored in the database

I am attempting to recreate the Backup Codes feature of Google by generating four random 8-digit numbers. for(let i = 0; i < 4; i++) { let backendCode = Math.floor(Math.random() * (99999999 - 10000000 + 1) + 10000000); backendCodes.push(back ...

A guide to Embedding a Variable Template Within an Anchor Tag in Django Templates

Just starting out in web development, Django, python, html, you name it. Currently, I have a simple Django app that lists publication titles stored in the database. It's working fine. Now, my goal is to turn each publication title into a clickable li ...

Unable to retrieve parameters upon passing navigate

Having two navigators set up, one named Auth which is a StackNavigator containing the SignInScreen, and another called App which is a BottomTabNavigator with the HomeScreen. I am trying to navigate from the HomeScreen to the SignInScreen while passing some ...

What is the most secure and accurate method for altering an object's state variable in React?

Behold, the code below has been tried and tested, effectively updating the state variable of the object: import { useState } from 'react' import './App.css'; function App() { const [config, setConfig] = useState({ status: & ...