I have a small problem with a script.
I want to have a default action on :hover
for clients with Javascript disabled, but for those with Javascript enabled I want another action (actually... same action, but I want to add a small transition effect).
So... How can I do this? I am using jQuery.
One method to do this is to add: pointer-events: none; to the element, you want to disable hover on. (Note: this also disables javascript events on that element too, click events will actually fall through to the element behind ).
Go to the WordPress Customizer > Additional CSS tab and write the following CSS. This code will take care of the hover state and the current menu item state as well. For the second question In the next updates I will add some generic colorpickers you can use to change some color styles. Cheers!
The :hover selector is used to select elements when you mouse over them. Tip: The :hover selector can be used on all elements, not only on links. Tip: Use the :link selector to style links to unvisited pages, the :visited selector to style links to visited pages, and the :active selector to style the active link.
Apply two classes to the relvant element. one contains the hover behaviour, and one contains all the other styling.
You can then use the jquery
$(element).removeClass('hover');
method to remove the class with the hover behaviour and then apply whatever you want using
$(element).bind('mouseover', function () { doSomething(); }); $(element).bind('mouseout', function () { doSomething(); });
How about putting the :hover
fall-back in a stylesheet that is only loaded if javascript is disabled?
<noscript> <link href="noscript.css" rel="stylesheet" type="text/css" /> </noscript>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With