At times, the Kendo UI Tooltip may linger on screen longer than expected, failing to disappear as

I've been experimenting with this issue for quite some time now, but I'm stumped. Whenever I quickly move my mouse cursor over a series of links, occasionally a tooltip will linger on the screen even after the cursor has moved away from the link.

I'm confident that my code is logically correct, but I can't figure out why these lingering tooltips are occurring. Can someone else take a look and see if they can spot the problem?

Here's an example of the link:

<a href="www.rich.com" onmouseover="tooltip(this); this.onmouseover=null;">Link</a>

This is the code in question:

function tooltip(e) {
    var ticketType = j$(e).data("ticket-type");
    var ticketID = j$(e).data("ticket-id");
    j$.post("/Some/Url/", { "ticketID":ticketID, "ticketType":ticketType },
        function(r) {
            var title = r["tt"];
            var tooltip = j$(e).kendoTooltip( { content: title, position: "top" } ).data("kendoTooltip");
        }).always(function() {
            if (j$(e).is(":hover")) { j$(e).data("kendoTooltip").show(); }
            else { j$(e).data("kendoTooltip").hide(); }
        });

    j$(e).hover(function() {},
        // Handler for when the pointer is leaving an element
        function(e) {
            if (j$(e.target).data("kendoTooltip") != undefined) {
                j$(e.target).data("kendoTooltip").hide();
                .log(e.target.innerHTML + ": was hidden.");
            }
        }
    );
}

Answer №1

It seems that the issue arises when you move the mouse out of the element before the AJAX post returns, causing the tooltip to display after you've already left the link. In addition to hiding on mouseout, one solution could be to set a data attribute on the target link so that the AJAX response can check this attribute before displaying the tooltip:

function tooltip(e) {
    j$(e).data("hover", "true"); //activate hover data attribute
    var ticketType = j$(e).data("ticket-type");
    var ticketID = j$(e).data("ticket-id");
    j$.post("/Some/Url/", { "ticketID":ticketID, "ticketType":ticketType },
        function(r) {
            var title = r["tt"];
            var tooltip = j$(e).kendoTooltip( { content: title, position: "top" } ).data("kendoTooltip");
        }).always(function() {
            if (j$(e).data("hover") == "true") { j$(e).data("kendoTooltip").show(); }
            else { j$(e).data("kendoTooltip").hide(); }
        });

    j$(e).hover(function() {},
        // Handler for when the pointer is leaving an element
        function(e) {
            j$(e).data("hover", "false"); //deactivate hover data attribute
            if (j$(e.target).data("kendoTooltip") != undefined) {
                j$(e.target).data("kendoTooltip").hide();
                console.log(e.target.innerHTML + ": was hidden.");
            }
        }
    );
}

Demo Link

Please note that the demo uses a setTimeout function to simulate an AJAX call.

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

Guide to vertically aligning text in an overlay using CSS within Angular 2

I currently have an overlay on my page that displays a spinner (an Angular material component) and accompanying text. This overlay covers the entire page and prevents clicking on elements below it. The spinner is positioned in the center of the page, and ...

Steps to connect my CSS with my HTML in a website hosted on GitHub

I am experiencing an issue with my website hosted on Github pages. It seems to be unable to read the CSS file that I have linked to it. Here is a snippet of my HTML code: <!DOCTYPE html> <link rel="stylesheet" type="text/css" href="https://githu ...

Can you place 4 table cells in the first row and 3 table cells in the second row?

Exploring the world of HTML and CSS designs for the first time. Here's a code snippet I've been working on: <html> <body> <table width="100%"> <tr> <td width="25%">&#160;</td> ...

Tips for troubleshooting an Express application launched by nodemon through a Gulpfile in WebStorm 10

I have a unique Express application that is powered by a Gulpfile configuration. gulpfile.js 'use strict'; var gulp = require('gulp'); var sass = require('gulp-sass'); var prefix = require('gulp-autoprefixer'); va ...

Creating the x and y coordinates for drawImage in HTML5

Understanding the x and y axis has posed a challenge for me: //retrieve last known x and y coordinates ...code var p = $("#draggable"); var offset = p.offset(); var x = offset.left; var y = offset.top; //establish new font siz ...

Adjusting the filter location in React-admin

This is the common method of implementing filters in react-admin https://i.stack.imgur.com/M8yq7.png However, in my particular scenario, I require the filters to be inside each column heading. For example: https://i.stack.imgur.com/GU2Pz.png The filter ...

Guide on how to organize a list into three columns using a single ul tag

Is there a way to split a ul list into 3 columns using CSS? This is how my HTML structure looks like: <ul> <li>Test</li> <li>Test</li> <li>Test</li> <li>Test</li> <li> ...

Please send the element that is specifically activated by the onClick function

This is the HTML code I am working with: <li class="custom-bottom-list"> <a onClick="upvote(this)"><i class="fa fa-thumbs-o-up"></i><span>upvote</span></a> </li> Here is my JavaScript function for Upvot ...

Guide to creating "bidirectional data binding" in Vue

I have a child component that is responsible for uploading a photo. The uploaded photo is assigned to the child component's data called "photo". I need to connect the parent data called "file" with the child data called "photo". And whenever "photo" i ...

unable to access the object3D within the current scene

Currently facing an issue where I am unable to retrieve Object3D from the scene, despite the mesh objects being displayed within the scene. Strangely, the scene.children array does not reflect this. Take a look at the screenshot here Here is the code sni ...

During the initial render in next-auth, the useSuspenseQuery function is triggered to fetch data without a defined token, resulting in an

Recently, I've started implementing the new useSuspenseQuery feature from react-query and I couldn't help but notice that the enabled property is missing on this hook. This has caused an issue with my useGetApiToken function, as it initially retu ...

Tips for successfully uploading FormData files using Axios: Resolving the TypeError of "file.mv is not a function"

When transmitting a file from one server to another using Axios, I am facing an interesting scenario where one server is an app backend and the other is a blockchain server. The destination for the file transmission is set up as follows: router.post("/a ...

The successful execution of an AJAX call is contingent upon the response echoed from PDO

I am seeking assistance to customize the success message in an ajax call based on the result of inserting data into a MySQL table. $.ajax({ data: dataString, type: 'POST', url: 'mypage.php', ...

What is the process for installing and utilizing the custom CSSLint rules that I have developed for the command line interface?

After investing a significant amount of time into following the instructions outlined here and here for creating custom CSS linting rules using CSSLint via the CLI, I have successfully generated and tested my own set of rules. However, I am now facing the ...

How can I ensure that my navbar-right remains fixed to the right side of the screen and is always visible at the top of the page as I

When the page first loads: After scrolling down: I am attempting to create a fixed navigation bar at the top of the screen, so that it remains visible as the user scrolls down the page. However, I am facing an issue where my navbar brand is positioned to ...

Instructions for passing a single value from a while loop and showing a different value in a text box through PHP

Can one value be displayed while sending another value in an Input text field simultaneously? I have a form that displays details in descending order, but when I update the details from another page, they are being updated in ascending order instead. Cod ...

Is it possible to retrieve an array using axios?

Currently, I am exploring computed properties in Vue.js. One of the computed methods I am working on involves making a request to an axios API to retrieve an array after applying some logic within the promise. computed: { filteredTrips: function () { ...

Maintain the HTML font color when printing - Issue with IE settings, not the printer

I've been struggling with this issue all day. Initially, I thought it was a problem with the print settings, but then I realized that it's actually the "Print background colors and images" option in IE causing the trouble. Here is the last test ...

Tips for utilizing socket.io for managing requests

Trying to implement socket.io for communication between an HTML page and an HTTP server, encountering the error message "Cannot POST / [HTTP/1.1 404 Not Found 1ms]". Below is the server-side code: var express = require('express'); var app = expr ...

Put the code inside a function. I'm new to this

My goal is to encapsulate this code: if($(window).width() > 980) { $(window).on("scroll", function() { if($(window).scrollTop() > 20) { //add black background $(".x-navbar").addClass("active"); $(".x-navbar .desktop ...