Perplexed by the Cufon hover issue

I am really frustrated right now because I can't seem to get Cufon working properly. I have a span link with text inside it, and I want the font color to change when hovered over.

Cufon.replace('.info-grid a span', { fontFamily: 'Vegur', hover: true, color: 'white', hoverables: { a: true, span: true } });

Despite the code above, the font is always white when the site loads. I suspect it's because the hover state isn't being set correctly. I've tried setting the .info-grid a:hover span class but it doesn't seem to be working.

This is how my CSS looks...

.info-grid a span {
    position: relative;
    left: 10px;
    top: 80px;
    font-size: 0.94em;
    line-height: 1.3em;
    font-weight: bold;
    text-transform: uppercase;
    color: #009FD4;
    background-color: #ffffff;
}
.info-grid a:hover span {
    color: #fff;
    background-color: #009FD4;
}

And here is a snippet of my HTML...

<div class="info-panel" id="info-firstteam">
    <h3>First Team</h3>

         <div class="info-grid">

         <div>
              <a href="../players/profiles/1.html" class="pic-no1">
              <p id="nametext"><span id="firstline">James</span><br><span id="secondline">Tillotson</span></p>
              </a>
         </div>

         <div>
         ...additional divs for players
         </div>

</div>

Answer №1

If you intended to set up the color for :hover styling, then you should include that rule within the hover property. Here's how:

Cufon.replace('.info-grid a span', { 
  fontFamily: 'Vegur', 
  hover: {
    color: 'white'
  },
  hoverables: { a: true, span: true } 
});

The documentation mentions that nesting :hover-enabled elements is not recommended and could result in unpredictable outcomes.

Considering this, it might be better to rely on the :hover state of a only for color changes by using the following code instead:

Cufon.replace('.info-grid a', { 
  fontFamily: 'Vegur', 
  hover: {
    color: 'white'
  }
});

Since <a> elements are 'hoverable' by default, this approach would suffice in your case.

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

Add necessary information to current document

I have encountered a unique challenge with AJAX. Let me explain the situation at hand: There is a form with submit=javascript:function() This function triggers an AJAX call with certain values, and upon success, I aim to add some content with a &apo ...

The message of error is undetermined

Can someone help me with using the errorMessage object from routes in a partial? I have attempted to implement it as shown below: Route:- const express = require("express"); const router = express.Router(); const Character = require("../models/character" ...

A comprehensive guide to using Reactive Forms in Angular

I need help understanding how FormGroup, FormControl, FormArray work in Angular. The error message I'm encountering is: Type '{ question: FormControl; multi: true; choices: FormArray; }' is not assignable to type 'AbstractControl' ...

Having issues with the CSS dropdown menu not activating when hovering

I am facing an issue with a simple menu that includes a dropdown feature upon hovering. The code works perfectly fine in Fiddle, however, it fails to work when running the entire page locally on IE. Can someone please assist me? (here's my code at fi ...

The meteorite experienced a crash as startup.js attempted to connect with Mongo

Setting up a Mongo database for a meteor project has been tricky for me. I've created a startup.js file to load the necessary files, but as soon as I start meteor, it crashes. Can anyone lend a hand, please? Here is a snippet from the HTML file: < ...

Tips for shrinking a sticky header when scrolling using Angular and JavaScript

Looking for a way to modify the header component in an Angular application so that it shrinks as the user scrolls down while maintaining its sticky functionality. How can I adjust the display of the lower half of the header to show no text when the user s ...

Verify if a value in a MongoDB field exists within an array field of the document

I need to verify if the date stored in the sessionDate field of my MongoDB document exists within the unavailableDates array. Here is the schema I am using: const adminSchema = new mongoose.Schema({ sessionDate:{ type: Date }, unavaila ...

Updating the Background Image Based on Text Input in JavaScript

Struggling to utilize the text entered into a text input field as a background image URL. Ensuring it is valid is key. This snippet displays what has been attempted so far... CSS: body { margin: 0px; padding: 0px; border: 0px; } .bgimg { backgr ...

Achieving a full background with Bootstrap 4: the step-by-step guide

Is there a way to ensure that the background completely covers the container? I am working with Bootstrap 4 and have shared my CSS code for the background image below: <div id="form_wrapper" style="background-image:url('img/bg.png&ap ...

Enable the input field to function as a numerical input for both desktop and mobile platforms

In my app, there is an input field set as type number where users can click to increase or decrease the value or manually input a number. <input type="number" name="quantity" id="quantity" value="1" class="form-control" min="1"> However, when I sw ...

Attempting to generate an absolute Xpath for the Add button, which is a subelement

I'm struggling to locate the Add button on our website, which I am in the process of automating using Python and WebDriver. Despite trying various Xpath suggestions without success, I've consulted with the developer who informed me that the butto ...

What is the best way to eliminate the blue color from a Boostrap 5.3 accordion item when it is opened?

As shown in these two images, I am looking to remove the blue color and blue border when opened: https://i.sstatic.net/vOIna.png https://i.sstatic.net/7eLfK.png <div class="accordion-item"> ...

Is it possible for the Observable call in Angular 4 to function similarly to jQuery's synchronous AJAX method?

As I have a business logic function that needs to use HttpGet and I must wait for the result before continuing, jQuery's ajax can handle this easily. But I am curious if Observables have a similar feature? I was hoping for the result to be: John An ...

If the content within a <div> element exceeds the available width, a horizontal scrollbar will be displayed

I have a scenario where I am using an absolute div to overlap another div. The div that overlaps is the absolute one (.content), and if the overlapped div (.left) doesn't fit the screen width, a horizontal scroll bar does not appear. How can I automat ...

Show identification as an alternative term in the chart

Is there a way to display an id in a table cell as another name from a different object with corresponding ids? I want to achieve something like this if it's possible: <td class="tableRowText"><p>{{l.SenderId}}</p></td> simil ...

Exploring the documentation of JQuery's $.Ajax Function

Can anyone help me locate the parameters in the JQuery Docs? jqXHR.done(function( data, textStatus, jqXHR ) {}); http://api.jquery.com/deferred.done/ I've been trying to determine what data represents but haven't had any luck. I've notic ...

The checkbox filter in Angular 6 has the ability to replace the previously selected

I've been working on creating a filter system using checkboxes. Below is a snippet of the code I'm currently using: filter.pipe.ts import { Pipe, PipeTransform, Injectable } from '@angular/core'; @Pipe({ name: 'filter2' }) ...

Utilize the sendKeys method to input text and save the entered value in

Currently, I am using WebdriverJS to interact with a form. In my test, I want to open the form, fill in a field using sendKeys, and then store this value in a variable. Here is the code snippet: driver.findElement(By.xpath("//a[contains(text(),'Añad ...

Identifying repetitive elements within an array of objects using JavaScript/Node.js

In my code, I have an array named offers containing objects structured like this: { sellItem: { id: _, quantity: _ }, buyItem: { id: _, quantity: _ }, volume: _ } My goal is to identify duplicates w ...

Angular and Express: Automatically redirecting to the previous page after user login

A question similar in nature can be found here, although not directly relevant to my situation. Within my Single Page Application, I am implementing PassportJS for user authentication. There are multiple routes that necessitate user login. The routing is ...