Is there a way to modify the text color when hovering over an image map?

I am facing an issue with my code. My goal is to change the text color (headline and subline text) from black to white. The default image contains 10 Hotspots, each with its own text. Upon hovering over a Hotspot, a new background-color (new image-map with corresponding hotspot) will load and the text color will change. While hovering over the hotspot and headline works fine, hovering over the subline-text changes the color to white but highlights the next hotspot instead. I'm unsure of what the problem could be.

Below is my HTML code:

<!-- MAP BEGIN -->
<div id="shoppingMap">

    <!-- HIDDEN MAPS BEGIN -->
    <img class="shoppingMap-image one" src="area_one.jpg" usemap="#ShoppingMap" /> 
    <img class="shoppingMap-image two" src="area_two.jpg" usemap="#ShoppingMap" />
    ...
    <img class="shoppingMap-image ten" src="area_ten.jpg" usemap="#ShoppingMap" />
    <!-- HIDDEN MAPS END -->

    <!-- IMAGE-MAPPING BEGIN -->
    ...
    </map>
    <!-- IMAGE-MAPPING END -->

    <!-- DEFAULT MAIN TEASER BEGIN -->
    <img src="floors&amp;corners_1010x764.jpg" width="1010px" height="764px" usemap="#ShoppingMap"/>
    <!-- DEFAULT MAIN TEASER END -->

    <!-- HEADLIN- & SUBLINE TEXT BEGIN -->
    <div class="areaOne">
        <span class="headlineText">Party wear</span>
        <span class="sublineText">Make your next night out extra special</span>
    </div>
    <!-- HEADLIN- & SUBLINE TEXT END -->

</div>
<!-- MAP END -->

And here is the jQuery code:

   
$(document).ready(function(){
 $('.mapArea, .headlineText, .sublineText').hover(function(){
    var current_area = $(this).index();
    $(this).parents('#shoppingMap').find('img.shoppingMap-image').eq(current_area).addClass('active');
    $('.headlineText, .sublineText').css({'color': '#fff'});
    $('#shoppingMap img').not('.shoppingMap-image').css({'display':'none'});
    }, function(){
    var current_area = $(this).index();
    $(this).parents('#shoppingMap').find('img.shoppingMap-image').eq(current_area).removeClass('active');
    $('.headlineText, .sublineText').css({'color': '#333'});
    $('#shoppingMap img').not('.shoppingMap-image').css({'display':'block'});
    });
});

Here is the CSS code:

   /* HEADLINE TEXT */
...

Answer №1

customize your sheet design.

.productImage:hover{background-color:#ffffff,color:#333333}.

Answer №2

Include the following styles in your CSS file and test them out.

#shoppingMap .headlineText:hover, #shoppingMap .sublineText:hover{
   color :red; 
}

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

Can Keyboarddatepicker automatically format the date?

We are utilizing material ui Keyboarddatepicker in our React application and have specified the date format using props as format=DD/MMM/YYYY, resulting in dates being displayed like "10/12/2020". The date picker functions perfectly when selecting a date. ...

"Implementing database updates with AJAX and utilizing the PUT method: a step-by-step guide

I am attempting to update a database property named "Estado" using ajax. Here is the code I am using: function updateDatabaseProperty(idMarker, newState) { $.ajax ({ url: `/api/IgnicoesAPI/${idMarker}`, type: 'PUT ...

Why anchors act differently with a defined base URL

During development, I often use href="#" as a placeholder link. This way, if it's accidentally clicked on, nothing happens and the page doesn't jump around while testing. It helps me distinguish between placeholders and broken links. However, wh ...

Adjust the z-index of the dynamically generated image label to ensure that it is not obscured by the image

Currently, I am working on implementing drag and drop functionality where users can drag multiple images and drop them into a div. Once the user clicks on a button, a p tag is dynamically appended as a label to each image. My issue arises when two images ...

Using the keyof lookup in a Typescript interface is a powerful way to

I'm looking for a solution similar to: interface Operation<T, K extends keyof T> { key: keyof T; operation: 'add' | 'remove'; value: T[K]; } but without the necessity of passing K as a template. Essentially, I want to ...

The outcome of my function designed to calculate the highest possible profit using k transactions is a null array

I have developed a custom function to calculate the maximum profit from a series of stock transactions given a specific number of transactions allowed. Each transaction involves buying at a low price and selling at a higher price, with the rule that you ...

I am struggling to figure out the best way to save JSON data retrieved from an API request in a Node.js Express server, and then efficiently send it to a React Native client

My Node.js server is up and running with an app.js file structured like this: var createError = require('http-errors'); var express = require('express'); var path = require('path'); var cookieParser = require('cookie-pars ...

AngularJS: Changing color property using toggle when a CSS class is modified

After starting to learn AngularJS, I have been able to find many helpful answers on this forum. However, there is one particular issue that has been causing me frustration. My goal is to dynamically change the color property of an element only when it has ...

Tips for specifying which project starts the setup process in Playwright

I have multiple projects in my playwright.config file, all of which have the same setup project as a dependency. Is there a way to determine at runtime which parent project is initiating the setup process? playwright.config projects: [ { name: " ...

Getting the location of a mouse click and adding tags (marks) on an image: a simple guide

Is there a way to incorporate images with tagged marks similar to Facebook's image tagging feature? How can I retrieve the X and Y coordinates of tags on the image itself (not the screen) and display them in a responsive manner? ...

MUI: tips for positioning text next to each other on a page

I need assistance aligning numbers and text side by side, similar to the image shown here: https://i.sstatic.net/gXzOM.jpg However, there is a margin to the right of the text(MASTER I 406), causing the numbers to not be in the correct position. Currently, ...

Using the $.each loop to iterate through JSON data within the <optgroup>

I am currently working on extracting information from a JSON file and displaying the subsectors within <optgroup label=""> tags in a non-selectable format. The JSON file I am working with looks like this: { "sectors": [ { "title": "Busi ...

restricting the number of items displayed in a select box - including scroll functionality

Is there a way to add scrollbars to an HTML select box with around 50 items? The current list is too long and I would prefer to have it scrollable. How can this be achieved? ...

Utilize Vuex mutators within route navigation guards

Hey there, I'm currently working on an app using Laravel and VueJS. To restrict certain routes, I've implemented navigation guards. However, I'm facing an issue where I need to access Vuex mutators to determine if the current user is logged ...

Facing issues with Handsontable opening within a jQuery UI dialog?

After implementing the Handsontable plugin in multiple tables, everything appears as expected on the parent page. However, when attempting to open a dialog containing a table, the tables do not display properly (only in IE). A demonstration of this issue c ...

Tips for positioning the footer in HTML and CSS

footer { background-color: #000000 } .footer-nav { list-style: none; } .footer-nav li { display: inline-block; margin: 15px; font-weight: 400; font-size: 80% } .social { list-style: none; } .social li { display ...

jquery monitors an element to see if it contains a particular attribute, then takes action accordingly

I'm attempting to conceal a div when an anchor tag (a) has a particular href, and reveal it when the href is different. This is what I've tried: if($('a[href="#intro"]').not(".active")) { $('.navbar-brand').hide();} else ...

A guide on how to apply filtering to an array in Vue using another array

Currently, I have two arrays of objects: one is named submodules and it contains a children array within it. My goal is to filter these children arrays based on another array called accessed. new Vue({ data: { submodules: [ { type: ...

Tips for minimizing the padding/space between dynamically generated div elements using html and css

Currently, I have 4 dropdown menus where I can choose various options related to health procedures: Area, specialty, group, and subgroup. Whenever I select a subgroup, it dynamically displays the procedures on the page. However, the issue I am facing is th ...

Sending Data to Server using Ajax and Receiving in PHP

Having some trouble with my AJAX data submission process. I can't seem to get the final value to work properly. I'm wondering if it's possible to set a PHP variable at the start of my HTML file and then use that in the AJAX post request? H ...