The hover feature on my website is making the picture flicker

I am experiencing an issue with a map on my website that contains four colored squares. When I hover over one of the squares, the image of the map changes to show the route corresponding to that color. However, this causes the image to shift position and interfere with the "hitbox" of the other squares, making it difficult to interact with them effectively.

This is the link to the page: link

<?php get_header(); ?>
    <div class="gdlr-content">

        <!-- Above Sidebar Section-->
        <?php global $gdlr_post_option, $above_sidebar_content, $with_sidebar_content, $below_sidebar_content; ?>
        <?php if(!empty($above_sidebar_content)){ ?>
            <div class="above-sidebar-wrapper"><?php gdlr_print_page_builder($above_sidebar_content); ?></div>
        <?php } ?>
        
        <!-- Sidebar With Content Section-->
        <?php 
            if( !empty($gdlr_post_option['sidebar']) && ($gdlr_post_option['sidebar'] != 'no-sidebar' )){
                global $gdlr_sidebar;
                
                $gdlr_sidebar = array(
                    'type'=>$gdlr_post_option['sidebar'],
                    'left-sidebar'=>$gdlr_post_option['left-sidebar'], 
                    'right-sidebar'=>$gdlr_post_option['right-sidebar']
                ); 
                $gdlr_sidebar = gdlr_get_sidebar_class($gdlr_sidebar);
        ?>
            <div class="with-sidebar-wrapper">
                <div class="with-sidebar-container container">
                    <div class="with-sidebar-left <?php echo esc_attr($gdlr_sidebar['outer']); ?> columns">
                        <div class="with-sidebar-content <?php echo esc_attr($gdlr_sidebar['center']); ?> columns">
                            <?php 
                                if( !empty($with_sidebar_content) ){
                                    gdlr_print_page_builder($with_sidebar_content, false);
                                }
                                if( !empty($gdlr_post_option['show-content']) && $gdlr_post_option['show-content'] != 'disable' ){
                                    get_template_part('single/content', 'page');
                                }
                            ?>                          
                        </div>
                        <?php get_sidebar('left'); ?>
                        <div class="clear"></div>
                    </div>
                    <?php get_sidebar('right'); ?>
                    <div class="clear"></div>
                </div>              
            </div>              
        <?php 
            }else{ 
                if( !empty($with_sidebar_content) ){ 
                    echo '<div class="with-sidebar-wrapper">';
                    gdlr_print_page_builder($with_sidebar_content);
                    echo '</div>';
                }
                if( empty($gdlr_post_option['show-content']) || $gdlr_post_option['show-content'] != 'disable' ){
                    get_template_part('single/content', 'page');
                }
            } 
        ?>
        
        <!-- Below Sidebar Section-->
        <?php if(!empty($below_sidebar_content)){ ?>
            <div class="below-sidebar-wrapper"><?php gdlr_print_page_builder($below_sidebar_content); ?></div>
        <?php } ?>
                    
    </div><!-- gdlr-content -->
    
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

    <!-- Início do código para o hover no mapa - colocar no final do arquivo html -->


<map name="legenda" id="legenda">
    <area alt="bh" title="" href="#" shape="rect" coords="744,728,977,748" />
    <area alt="mariana" title="" href="#" shape="rect" coords="745,767,922,785" />
    <area alt="ob" title="" href="#" shape="rect" coords="745,803,959,820" />
    <area alt="transfer" title="" href="#" shape="rect" coords="745,839,1087,860" />
</map>

<script type="text/javascript" src="/imageMapResizer.min.js"></script>
<script type="text/javascript">
      imageMapResize();
    $('#legenda area').each(function () {
    // Assigning an action to the mouseover event
    $(this).mouseover(function (e) {
      var id = "#" + $(this).attr('alt');
      $(id).show();
      $("#base").hide();
    });

    // Assigning an action to the mouseout event
    $(this).mouseout(function (e) {
      var id = "#" + $(this).attr('alt');
      $(id).hide();
      $("#base").show();
    });

  });
</script>

    
<?php get_footer(); ?>

It was supposed to work fine :(

Answer №1

If you eliminate the <br> tags between the images, it brings you much closer to achieving the desired outcome. To address the remaining gap, I grouped all images into the same <div>, resulting in a perfect solution.

In my opinion, positioning the four colored squares outside the map would be beneficial, as it may not be immediately evident that hovering over the squares will alter the map.

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

What is the best way to retrieve a value from an asynchronous method in Node.js that is using promises and also calling another asynchronous method?

I have created two methods for verifying the availability of data in a database and storing the data. The methods are as follows: function IfUserExists(userId) { logger.info(`Checking If ${userId} exists`); return new Promise(resolve => { ...

Leveraging Angular's catchError method to handle errors and return

One of my challenges involves a model class that represents the server response: class ServerResponse { code: number; response: string; } Whenever I make api calls, I want the response to always be of type Observable<ServerResponse>, even in ...

JSON containing attributes represented by Unicode characters

During the development of my web application, I am interested in utilizing JSON objects with Unicode attributes as shown below: a = { ονομα:"hello" } Subsequently, I would like to access it in this manner: a.ονομα Alternatively, exploring lo ...

Screen the $http request information prior to transmission

Angular has a built-in feature that removes properties with a prefix of $$ from request data or params objects. I want to filter out my own UI-specific properties that I don't want to send to the server, but I don't want to rely on using $$. Is ...

Centered Layout using HTML and CSS

Exploring the world of Ruby on Rails and HTML has been quite an adventure. Today's question veers away from RoR and focuses on HTML and CSS. As I attempt to center my body, a peculiar issue arises: Help me solve this problem here How can I align the ...

How to utilize a prepared statement in MySQL using NodeJS for inserting or updating data in a specific table?

Below is the code snippet I need assistance with: connection.query({ sql: 'CREATE TABLE ? ( `wage` FLOAT NOT NULL , `monday` FLOAT NOT NULL , `tuesday` FLOAT NOT NULL , `wednesday` FLOAT NOT NULL , `thursday` FLOAT NOT NULL , `friday`) ENGINE = InnoDB ...

Managing multiple JQuery Dialog boxes can be tricky, especially when you can only close one instance at a time

I'm currently working on integrating multiple instances of Jquery's Dialog box on the same website. The issue I'm facing is that I have two instances that I initialize using a new function like this: function Modal(param) { this.modal = ...

Reorganizing JSON Information

Currently, I am dealing with a JSON file that contains multiple sets of data structured like this: {"name": ["Adelphi University"], "supp": ["Yes: E, WS"], "ed": ["\u00a0"], "online": ["$40"], "ea": ["12/1"], "mid": ["No"], "rd": ["Rolling"], "recs": ...

Unable to examine a specific component

As I attempt to inspect an element by right-clicking and selecting "Inspect," I encounter the following details: Screenshot1 Screenshot2 Despite trying the code snippet below, it did not yield the desired results for me: driver.findElement(By.id("tmsMo ...

Shadows are not being cast by ThreeJS

I'm in the process of creating a simple Three JS application. As I familiarize myself with Three JS, I've been experimenting with different features. Currently, I am working on constructing a scene that includes a floor, an object, and a light so ...

What is the best way to include and transmit multiple records in ASP.NET MVC with the help of jQuery?

Having trouble sending multiple records to the database using JavaScript in ASP.NET MVC? Look no further, as I have the best code that can send data to the controller. However, the file attachment is not being sent along with it. I've tried various m ...

Explore our interactive map and widget features that will seamlessly fill your browser window for a

Struggling to make a webpage with a Google Map, Chart, and Grid expand to fill the available space on the screen. Tried various CSS tricks but nothing seems to work. Check out this simplified example in JsFiddle that showcases the issue: http://jsfiddle. ...

What could be causing my object to not be added properly to a select element using JavaScript programmatically?

When it comes to customizing your pizza, the options are endless. From selecting the type of crust to choosing your favorite toppings, every detail matters. One common issue that arises is when changing the crust type affects the available sizes ...

Accessing form fields without relying on jQuery selectors

For instance: <form id ="f1"> <input type="text" id="quantity" /> </form> It's clear that using jQuery selectors incurs some overhead. Therefore, once the form is obtained using a selector, it would be preferable to avoid using ...

What is the best way to include an array in an object while only retaining a single column for each element in the array?

I am working with an array named answers on my webpage, which has the following structure: answers[{x: 1, r: true;},{x: 2,r: false;},{x: 3, r: true;}] I believe I have defined this correctly. The answers array consists of a variable number of rows (in th ...

The initial return value of $(document).height may be inaccurate, but is accurate upon recalculation

I am working on implementing a pop-up screen and I would like to darken the background when it opens. Below is the Javascript code: $(document).on('click', '.item', function(){ $("#popUp").css("display" , "block"); ...

``In a jade view, navigating through JavaScript object properties leads to the addition of quotation marks around strings

Utilizing the npm module traverse to filter data from mongodb / mongoose has been quite helpful for me. Here is an example of the kind of data I might receive: [ { rating: 5, title: { da: 'Web udvikling', en: 'Web Development' } } ...

Issues with executing google.script.run in Google Web App

I am encountering an issue with the function I have defined in my .gs file: function doGet(e) { return HtmlService.createHtmlOutputFromFile('index') } function goToMaster() { const ss = SpreadsheetApp.getActiveSpreadsheet() const sheet = s ...

Why are my basic style properties not appearing correctly when I use json_encode on an array?

My calendar is written in Javascript within a table with the ID "calendario," allowing me to manipulate it using calendario.rows[i].cells[i]. This calendar lets users make reservations and provides an option to close a day if there are too many reservatio ...

Exploring the functionality differences between mouse wheel tilt and scroll in JavaScript with scrollTop

Did you know that some computer mice come equipped with a scroll wheel that can tilt both left and right? This feature allows users to navigate through Google's piano roll app, which can be accessed here (source code available here). I am working to ...