Span wrapped in a hover effect

I am facing an issue with hover options...

What I am looking for is a text in a circle

Finally, I achieved the desired look using csswrap

Next, I added some jQuery to insert links into all spans with the same class

Everything is working fine, except for the hover effect.

I attempted to use:

span:hover a {color: red;}

However, it did not change the color of all "a" elements as expected. When hovering over one, it should change the color of all spans with the same class.

Is there a way to group all spans into one unique element without losing the circular effect?

$(".research").html(function(i, html){
  return "<a href='#' class='prvi'>"+ html +"</a>";
});

$(".schematic").html(function(i, html){
  return "<a href='#'>"+ html +"</a>";
});

$(".development").html(function(i, html){
  return "<a href='#'>"+ html +"</a>";
});

$(".activation").html(function(i, html){
  return "<a href='#'>"+ html +"</a>";
});

$(".celebration").html(function(i, html){
  return "<a href='#'>"+ html +"</a>";
});
#warped {position: relative; display: table; width:855px; height:618.0000019073486px;}

                     #warped>span[class^=w]:nth-of-type(n+0){display:block; position:absolute;
                     -moz-transform-origin:50% 100%; -webkit-transform-origin:50% 100%; -o-transform-origin:50%
                     100%; -ms-transform-origin:50% 100%; transform-origin:50% 100%; }

                     #warped span{font-family:'ABeeZee';font-size:20px;font-weight:regular;font-style:normal;
                     line-height:1; white-space:pre; overflow:visible; padding:0px;}

                     #warped .w0 {-moz-transform: rotate(-0.4rad);-webkit-transform: rotate(-0.4rad);-o-transform:
                     rotate(-0.4rad);-ms-transform: rotate(-0.4rad); transform: rotate(-0.4rad);
                     width: 12px; height: 20px; left: 234.42px; top: 70.65px;}

                     #warped .w1 {-moz-transform: rotate(-0.32rad);-webkit-transform: rotate(-0.32rad);-o-transform:
                     rotate(-0.32rad);-ms-transform: rotate(-0.32rad); transform: rotate(-0.32rad);
                     width: 6px; height: 20px; left: 247.26px; top: 67px;}

...

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="warped"> <div></div>
                     <span class='w0 research'>1</span><span class='w1 research'>.</span><span class='w2 research'>R</span><span class='w3 research'>e</span><span class='w4 research'>s</span><span class='w5 research'>e</span><span class='w6 research'>a</span><span class='w7 research'>r</span><span class='w8 research'>c</span><span class='w9 research'>h</span><span class='w10 research'> </span><span class='w11 research'>></span><span class='w12'> </span><span class='w13'> </span><span class='w14'>
                     </span><span class='w15 schematic'>2</span><span class='w16 schematic'>.</span><span class='w17 schematic'>S</span><span class='w18 schematic'>c</span><span class='w19 schematic'>h</span><span class='w20 schematic'>e</span><span class='w21 schematic'>m</span><span class='w22 schematic'>a</span><span class='w23 schematic'>t</span><span class='w24 schematic'>i</span><span class='w25 schematic'>c</span><span class='w26 schematic'> </span><span class='w27 schematic'>></span><span class='w28'> </span><span class='w29'> </span><span class='w30'>
                     </div>

Note: This is not a complete snippet, as the full circle effect has already been achieved.

Answer №1

You have the option to include nested <span> elements. Represented like this:

<span class='link'>
  <span class='w0 research'>1</span>
  <span class='w1 research'>.</span>
  <span class='w2 research'>R</span>
  <span class='w3 research'>e</span>
  <span class='w4 research'>s</span>
  <span class='w5 research'>e</span>
  <span class='w6 research'>a</span>
  <span class='w7 research'>r</span>
  <span class='w8 research'>c</span>
  <span class='w9 research'>h</span>
  <span class='w10 research'> </span>
  <span class='w11 research'>></span>
</span>

It is necessary to make slight adjustments to your CSS selectors in order to target all span elements except those with the .link class.

You can make use of the :not() pseudo-class for this purpose.

#warped span[class^=w]:not(.link):nth-of-type(n+0) {
  display: block;
  position: absolute;
  -moz-transform-origin: 50% 100%;
  -webkit-transform-origin: 50% 100%;
  -o-transform-origin: 50% 100%;
  -ms-transform-origin: 50% 100%;
  transform-origin: 50% 100%;
}

#warped span:not(.link) {
  font-family: 'ABeeZee';
  font-size: 20px;
  font-weight: regular;
  font-style: normal;
  line-height: 1;
  white-space: pre;
  overflow: visible;
  padding: 0px;
}

Subsequently, you can target the .link:hover selector to modify the color.

.link:hover {
  color: #c2932c;
}

View a demonstration of this concept in action on 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

Warning: Unhandled Promise Rejection - Alert: Unhandled Promise Rejection Detected - Attention: Deprecation Notice

Encountering the following error message: (node:18420) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined at C:\Users\ohrid\Desktop\backend2\routes\categories.js:27:24 at Layer.han ...

Utilizing AJAX to send an array of data in JSON format

I have successfully extracted specific elements from a form, stored them in an array and now want to convert this array into a JSON object to send it to a PHP file via AJAX. However, I am facing some issues with my code. Here's what I have done so far ...

verified firebase/firestore requests

I've been struggling with the process of sending authenticated firebase/firestore calls. I set up firestore in my web app using Next.js as shown below: import { initializeApp } from "firebase/app"; import { getFirestore } from 'firebase ...

Unable to fulfill the GET request

I'm currently working on a form to collect email addresses which will be posted to /dreamjob endpoint. Although there are no error messages when trying to access the /emails list, the page doesn't load and times out. I'm stumped on what the ...

How can you retrieve an array of multiple property values from a collection of dynamic objects?

I am currently working with a dynamic JavaScript object array that has varying structures. For example: var someJsonArray = [ {point: 100, level: 3}, {point: 100, level: 3}, {point: 300, level: 6} ]; At times, it may have a different combination lik ...

When I hover over one div within another div, JavaScript triggers the "onmouseover" and "onmouseout" events

I'm currently developing a grid layout for my upcoming website. Here is the PHP code snippet I'm working on: echo"<div class='model_container_invisible' onMouseOver='fade(this, 0)' onMouseOut='fade(this, 1)'>" ...

Function URL.createObjectURL is not defined in Reactjs

I am currently working on a loadfile function that is supposed to load an image after uploading. However, I am facing an issue with converting it to get its URL path. Whenever I try to do so, I encounter an error saying "URL.createObjectURL is not a func ...

Having trouble with AngularJS? Ng-switch not updating after ng-click?

Initially in my code, I check if a user has the ability to flag a discussion. If they do, I use ng-switch where upon flagging, a success message is displayed: <div ng-if="canFlag(discussion)"> <div ng-switch="isFlagging" ng-click="fla ...

Guide on linking an id with a trigger function in HTML and JavaScript

In the snippet below, I aim to create a responsive feature based on user input of 'mute' and 'muteon'. Whenever one of these is entered into the textbox, it will change the color of linked elements with the IDs "text" and "text1" to red ...

Encountering a problem with TypeScript while employing Promise.allSettled

My current code snippet: const neuroResponses = await Promise.allSettled(neuroRequests); const ret = neuroResponses.filter(response => response?.value?.data?.result[0]?.generated_text?.length > 0).map(({ value }) => value.data.result[0]?.genera ...

Node.js throws an error when accessing req.body as undefined

My task involved creating a basic API using node.js and express, with the addition of body-parser. However, I encountered an issue where req.body was returning undefined. Here is a snippet of my app.js: const express = require('express'); const b ...

The method to obtain a result array using the getJson function in CodeIgniter

Here is the code snippet I am working with: function retrieveAllProcessingTransactions() { $resultSet = $this->db->query("SELECT a.id_transaksi, ETC"); return $resultSet; } In my controller file: public function fetchTransac ...

Exploring elements in Javascript

I am attempting to retrieve values from various elements when a 'a' element is clicked. Consider the following code: <tr data-id="20"> <div class="row"> <td> <div class="btn-group"> <a data-checked= ...

Utilizing Firefox and Selenium with Python: A guide to dynamically accessing HTML elements

Currently, I am utilizing a combination of Python, Selenium, Splinter, and Firefox to develop an interactive web crawler. The Python script provides the options, then Selenium launches Firefox and executes certain commands. At this point, I am looking fo ...

Launching a website in an external browser from an iPad phonegap app

Similar Question: phonegap: how to launch external links in Safari instead of the app's UIWebView Developed an HTML5 app for my iPad using PhoneGap. The app includes external links to web pages. However, when clicking on these links, they ope ...

Troubleshooting AngularJS Directives' Cross-Origin Problems within Eclipse

Hello, I am facing an issue while using Angular JS in Eclipse. Specifically, when attempting to use Directives, I encounter a problem with the Cross-Origin Resource Sharing (CORS) policy when loading the Directives template in the index.html file. XMLHttp ...

Is there a way to ensure consistent border thickness in a material-ui table layout?

In my current setup of a material UI table, I have applied a 1-pixel thickness to all elements. This leads to a slightly thicker appearance at the points where two cells meet compared to the outer edges. How can I achieve a consistent border width of 1px ...

Designing numerous vertical lists in HTML

I need help with displaying multiple lists vertically using HTML For example: +--------+---------------------------------------------+--+ | Global | Region Country Currency Account Type Entity | | +--------+---------------------------------------------+ ...

Can a node.js file be exported with a class that includes IPC hooks?

[Node.js v8.10.0] To keep things simple, let's break down this example into three scripts: parent.js, first.js, and second.js parent.js: 'use strict'; const path = require('path'); const {fork} = require('child_process&apo ...

Is there an implicit transformation or action involved when the promise chain is resolved or rejected in $q?

Is there an intrinsic digest/apply included when the promise chain is resolved/rejected in $q? I recently switched from using $q to q in my code and it seems like a digest is no longer happening, leading to different outcomes. What could be causing this c ...