The jQuery click event will only trigger once the mouse has been moved, but the CSS hover effect will work properly even when the hover state is not active

I seem to be facing a similar issue like the one mentioned here: jQuery click event only working after moving the mouse in Chrome, but specifically on Mac OS X (tested on Chrome, Firefox, and Safari). The functionality works fine on Windows (skipping IE for this scenario).

Here is a link to my jsfiddle where the cells darken on hover and change color when clicked, which is the desired behavior. However, on Mac, the color change occurs only after moving the mouse, which is not intended: https://jsfiddle.net/martakule/gh8t2m6n/2/

If I remove the hover effect, everything works smoothly - the color changes instantly upon clicking. Could it be that CSS hover and jQuery click are not compatible on Mac? What could be causing this issue?

td:not(.main):hover {
    background: #cccccc;
    background: linear-gradient(to bottom right, #cccccc, #a6a6a6);
}

Answer №1

Consider using the "!important" declaration in your CSS rules for added specificity:

#yes, td.yes {
  background: green !important;
  background: linear-gradient(to top right, green, yellowgreen) !important;
}

Additionally:

#no, td.no {
  background: red !important;
  background: linear-gradient(to bottom right, red, maroon) !important;
}

(I'm glad I had my trusty mac to assist!)

Fiddle available here: https://jsfiddle.net/s8c7qm7g/

I hope this solution meets your needs.

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 techniques can I use to change multiple sibling elements with CSS when hovering over them?

Imagine a scenario where hovering over any row within group 1 changes the color of all rows within that same group. Now, extend this concept to apply to an unlimited number of groups, denoted by N. Let's consider having 300 groups, each consisting of ...

The looping function in JavaScript iterates 20 times successfully before unexpectedly producing NaN

run = 0 function retrieveItemPrice(id){ $.get('/items/' + id + '/privatesaleslist', function(data){ var htmlData = $(data); var lowestPrice = parseInt($('.currency-robux', htmlData).eq(0).text().replace(',& ...

What is the best way to implement jQuery in Katalon to manipulate the DOM element?

While browsing through the jQuery documentation, I discovered that I can update a custom attribute of a div using the attr() method. Is there a way to invoke this jQuery function in Katalon to modify the DOM element before a specific ajax call? I'm w ...

Is there a way to use JavaScript or jQuery to automatically convert HTML/CSS files into PDF documents?

While using OS X, I noticed that in Chrome I have the option to Save as PDF in the print window by setting the destination to "Save as PDF". Is this feature available on Windows? Is there a way to easily save to PDF with just one click? How can I access t ...

Having trouble with Jquery .attr() not picking up the value of my "data-link" attribute in an onclick event

I've encountered an issue with a snippet of jQuery code. I'm trying to add a new li element to my menu without using an href tag, instead, I want to control the link through JavaScript. For some mysterious reason, I am encoding the link in base6 ...

Updating the date format for database validation

There are only a few dates available in the database, and I need to select another date using a jQuery datepicker. The catch is that I can only choose a date from the database, and then display this validated date in an alert. The challenge lies in the fac ...

Troubleshooting a problem with jQuery child items

Could someone help me understand why the second div is affected by the last part of the code and not the first? It's puzzling to see all the content disappear, especially when I expected the first div to be impacted as it seems like the immediate pare ...

What is the correct method for caching fonts within an Angular application?

In the process of developing a web application similar to photoshop-minis using Angular, one key aspect I am focusing on is reducing load times. Particularly when it comes to fonts, as not all necessary fonts are available through Google Fonts. Instead of ...

Creating a design with CSS that allows floating boxes to completely occupy the wrapper element

This situation is really getting to me. I am currently in the process of creating a page that will feature a fixed header and footer, with dynamic boxes sandwiched in between. These boxes need to be properly arranged to fill the space within the wrapper c ...

Prevent the event from bubbling up on active elements

Having trouble with stopping event propagation? Picture this situation: <table id="test"> <tbody> <tr> <td class="row"> </td> <td class="row"> </td> <td class="ro ...

Experiencing difficulty modifying the information within a particular meta tag using JQuery

I am attempting to modify the content of a meta tag using JQuery, but I keep encountering an error: unidentified expression: [name=dc.description] This is the code I'm currently using: $('meta[name=description]').attr('content', ...

Identify the externally-sourced element of interest

I'm attempting to apply a ScrollReveal effect to an element loaded from a separate html file called "header.html". Unfortunately, the ScrollReveal animation is not working on this particular element, while other elements within my index.html are funct ...

What is the best way to display the time of a post update similar to the style of

I am currently working on creating a notification deck. Instead of displaying the time when a notification was received, I aim to show the time that has passed since its arrival similar to how Twitter and Facebook do it with formats like "32m" or "1 hour a ...

Validation of HTML5 forms for AJAX button submission

I am working with a form that utilizes the new HTML5 form validation feature, which I find to be beneficial. However, I do not like how pressing the button causes the page to refresh (form submit). Instead, I would like to use AJAX to update specific page ...

What steps can be taken to integrate JavaScript into an ASP.NET control?

<script type="text/javascript"> $(document).ready(function () { $('input[name="time"]').ptTimeSelect(); }); </script> the script shown above is functioning correctly with this HTML input: <input name="time" value= ...

Incorporating a dynamic fill effect into an SVG pie chart

I am looking to animate a pie chart with a variable value that is unknown upon loading. Assuming I fetch the value promptly and convert it into a rounded percentage : var percentage = Math.round(sum * 100 / total); Next, I place this value here : <di ...

Smooth vertical scrolling for the mousewheel using jQuery

I am currently working on a parallax website and I want to enhance the user experience by making the page scroll more smoothly with the mousewheel. I found inspiration from this website: I would love to incorporate a similar smooth vertical scrolling and ...

Is there a way to use jQuery to verify if an LI element contains a parent LI element?

Struggling with customizing the comments section of a WordPress theme? Utilizing jQuery for styling can be tricky, especially when dealing with nested UL elements like admin comments. The challenge lies in traversing the DOM structure to target specific el ...

The jQuery remove() function seems to be malfunctioning

Here is the given code snippet: function updateMsg() { $.post("AjaxChatServer.jsp",{ time: timestamp }, function(xml) { alert("1"); $("#loading").remove(); addMessages(xml); }); setTimeout('updateMsg()', 4000) ...

The Bootstrap modal popup fails to appear when utilizing the fade animation effect

I incorporated Bootstrap's JavaScript modal plugin into my application to introduce dialog boxes. While I am able to use it successfully, I encountered an issue when attempting to implement a fade animation when opening or closing a modal dialog. Fol ...