Display tooltip upon hovering

Can someone help me with my dot navigation tooltips? I've managed to make them visible, but now I want them to only appear on hover. What am I missing?

I've experimented with display: none and visibility but when I tried this code:

span.tooltip {
display: none;
}

span.tooltip:hover {
display: block;
}

Nothing changes, they remain invisible.

Check out the JSFiddle link here: http://jsfiddle.net/hEZmE/

HTML

<div id="cbp-fbscroller" class="cbp-fbscroller">
<nav>
                <a href="#fbsection1" class="cbp-fbcurrent"><span class="tooltip">Home</span></a>
                <a href="#fbsection2"><span class="tooltip">The Possibilities</span></a>
                <a href="#fbsection3"><span class="tooltip">Restoration</span></a>
                <a href="#fbsection4"><span class="tooltip">The Process</span></a>
                <a href="#fbsection5"><span class="tooltip">Workshop</span></a>
                <a href="#fbsection6"><span class="tooltip">Craftsmanship</span></a>
                <a href="#fbsection7"><span class="tooltip">Contact</span></a>
            </nav>

<section id="fbsection1"></section>
<section id="fbsection2"></section>
<section id="fbsection3"></section>
<section id="fbsection4"></section>
<section id="fbsection5"></section>
<section id="fbsection6"></section>
<section id="fbsection7"></section>

CSS

.cbp-fbscroller > nav {
position: fixed;
z-index: 9999;
right: 50px;
top: 50%;
width: 10px;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}

.cbp-fbscroller > nav a {
display: block;
position: relative;
z-index: 9999;
color: transparent;
width: 10px;
height: 10px;
outline: none;
margin: 25px 0;
border-radius: 50%;
border: 1px solid #333;
}

.no-touch .cbp-fbscroller > nav a:hover {
background: #333;
}

.cbp-fbscroller > nav a.cbp-fbcurrent {
background: #333;
}

#fbsection1 {
background-color: #ccc;
height: 800px;
}

#fbsection2 {
background-color: #aaa;
height: 800px;
}

#fbsection3 {
background-color: #ccc;
height: 800px;
}

#fbsection4 {
background-color: #aaa;
height: 800px;
}

#fbsection5 {
background-color: #ccc;
height: 800px;
}

#fbsection6 {
background-color: #aaa;
height: 800px;
}

#fbsection7 {
background-color: #ccc;
height: 800px;
}


span.tooltip {
position: absolute;
margin-top: -6px;
margin-left: -120px;
width: 100px;
height: 20px;
line-height: 20px;
font-size: 12px;
text-align: center;
color: #fff;
background: #333;
}

Answer №1

First and foremost, it's important to note that your current code is not functioning as intended due to the hover event being applied to the tooltip element, which is initially hidden from view—thus, you cannot trigger a hover action on something that is not visible (as astutely pointed out by berentrom).

span.tooltip {
    display: none;
}

span.tooltip:hover {
    display: block;
}

To achieve the desired behavior of displaying the tooltip when hovering over the dot, you should associate the hover event with the dot itself, rather than the tooltip.

You can accomplish this by adding the following CSS:

span.tooltip { 
    display: none; 
}

#cbp-fbscroller a:hover > span.tooltip {
    display: block;
}

For reference, please see the updated implementation here: http://jsfiddle.net/hEZmE/4/

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 on creating reusable scoped styles for 3 specific pages in Vue.js without impacting other pages

Our project includes global classes for components that are utilized throughout the entire system. <style lang="scss" scoped> .specialPages { padding: 0 10px 30px 10px; } /deep/ .SelectorLabel { white-space: nowrap; al ...

What is the best way to include a clickable button in an HTML email instead of a plain link?

My application has a feature where it sends emails through Java code. I want to include a clickable link within a button that says "Activate your account". Here is my current code snippet: Message message = new MimeMessage(sessionMail); message.setFrom(ne ...

Adjust the width of the table's td elements

I am looking to create a table similar to the one shown above. Here is my implementation. Please review my JSFiddle. HTML: <table border="0" id="cssTable"> <tr> <td>eredgb</td> <td><a href="self">0 ...

Incorporate a linked select dropdown into the registration form

I am working on a sign-up form and trying to integrate 2 linked select boxes into the form. The code for the linked select boxes works fine separately but when I attempt to add it to the form, it doesn't display as expected. I attempted to incorporate ...

Monitor the traffic on my website by implementing .htaccess restrictions

I am maintaining a website with restricted access to specific IP addresses listed in the .htaccess file. I am looking to implement a logging system that tracks unauthorized attempts to access the site. Is it feasible to record each attempt in a database? ...

Adjust the height of the div container and implement a vertical scroll feature on the fixed element

I created a fiddle and was hoping to enable scrolling, but I have been unable to find a solution. http://jsfiddle.net/sq181h3h/3/ I tried both of these options, but nothing seems to be working: #league_chat { overflow-y:scroll; } #league_chat { ...

Issues with implementing Dark mode in TailwindCSS with Nuxt.js

After spending a couple of days on this, I'm still struggling to get the dark mode working with Tailwind CSS in Nuxt.js. It seems like there might be an issue with the CSS setup rather than the TypeScript side, especially since I have a toggle that sw ...

"Modifying the form-control-lg class in Bootstrap and AngularJS affects input size exclusively, leaving the label unaffected

Currently, I am focusing on enhancing an AngularJS custom text input component: <div class="form-group has-feedback" ng-class="[$ctrl.sizeClass, {'has-error': $ctrl.isNotValid(), 'has-success': $ctrl.isValid()}]" > ...

Enhancing the efficiency of a JavaScript smooth scrolling feature for numerous listed items

I have been experimenting with recreating the recent Apple Mac retrospective using only CSS and JavaScript to create a small timeline of projects. While I have successfully implemented the layout for the full-screen hero and the expand-on-hover effect, I a ...

The issue with CSS right alignment not functioning as expected

My attempt to align text to the right using a CSS rule is not working as expected when applied to a font within a cell. Can anyone help me troubleshoot this issue? Take a look at my code snippet below: CSS: .font1 { font-size: 60px; text-align: ...

Divide HTML content based on headings

My HTML document has a structure similar to this: <h1><a id="first-id"></a>First header</h1> <h2>Foo</h2> <p>Some text</p> <h3>Bar 1</h3> <p>Some text</p> <h3>Bar 2< ...

Achieving Vertical Alignment of Two Divs with CSS

I've come across several solutions to my issue, but none of them seem to work in my current situation. I have a banner at the top of my site with two floated columns, and suspect that the navigation menu in the right column may be causing the problem. ...

How can we invert codes in PHP?

I've been examining the source code of a PHP website, but I'm finding that all pages have a similar format with unreadable PHP and HTML codes encapsulated within PHP tags. How can I reverse engineer this to understand how it gets translated into ...

Tips and tricks for seamlessly aligning a specific section of your webpage to ensure it scrolls smoothly into view

My codes are not being centered when I use smooth scrolling on a specific section of a Bootstrap carousel template. Is there an easier way to achieve this? The explanation in a post from six years ago didn't help much. Here are my codes and screenshot ...

What steps are involved in implementing an ordering system on a restaurant's website using React?

As I work on developing my portfolio using React, I'm interested in incorporating an online ordering feature. However, the information I have found through Google so far hasn't fully addressed my questions. Can anyone provide guidance on the best ...

Tips for sending every individual string object within an array as post data via ajax

I have a scenario where I am dealing with dynamically generated text boxes. Each value from these text boxes needs to be stored in a JSON array when submitted. The approach I took was to push all the values into an array and upon submission, these values a ...

Fill your background with a stunning background image

I have encountered a common issue where the existing solutions do not seem to solve my problem. The background image I am working with is taller than it is wide, and I want its height to be 100% of the body's height. To achieve this, I attempted the f ...

Is it possible to make a DIV adjust its size automatically when the browser is resized?

Greetings! Here's my initial query, with more to follow. I've encountered an issue where a div on my page is set to 70% of the screen, but upon resizing the browser to a smaller size, some content within the div extends past the bottom of the pa ...

What could be causing the bullet not to appear in Internet Explorer 6

It is visible in Firefox, but not in IE (specifically IE6). <style type="text/css"> li { list-style-type:disc; } </style> <div style="margin: 2px auto 15px; padding: 5px 0px; width: 480px; text-align: center;"> <ul style="margin: 0; ...

Is it possible to achieve the lower link set in a pure CSS horizontal menu where the horizontal link set is positioned below horizontal text tabs?

I am attempting to design a pure CSS on-hover horizontal menu. I have made some progress on my design, as shown in http://jsfiddle.net/dq8z192L/11/ The goal is to have a menu that expands horizontally when hovered over. Each tab reveals a set of links be ...