javascript - Detect whether a stationary cursor is hovering over a previously hidden, now visible element -
Description:
As the continuation of my last question (or perhaps the phrase again), I Trying to find out that the cursor is on the first hidden, now-feed-in element, in fact it is not taking the cursor to do this.
It is setup: leave the mouse completely now, while one element has faded under it. Once fade-in animation is complete, a script should be found that the new revealing element is underneath the cursor and then jQuery.trigger ()
or a mouse event through some means shuts off.
In the Belle below, the red box only indicates where someone should place their cursor; This is not to be used otherwise. Perhaps the most important thing is that I want to know that it is possible to accomplish this task without monitoring the mouse coordinates.
Fiddle:
code:
setTimeout (function () {// element $ $ ('# Kitty') Feeds in FadeIn ('slow', function () {// confirms that the element exists ($ ('$ kitty'). Length! = 0) {// move the mouse cursor Below that do something to detect #kitty}});}, 3000); $ ('# Kitty') Mousecenter (function () ($ (this). CSS ({'Transform': 'Scale (1.5)', 'Transition': 'Transform 500ms'}}}} .moveleave (function () {$ (this) CSS ({'transform': 'scale (1)', 'transition': 'transmission 500 ms'})});
What about something like this?
Basically, you set a data parameter of that element that you want to see to hover the mouse , And then look at that parameter When it's time to check it.
setTimeout (function () {$ ('# kitty'). FadeIn ('slow', function () {if ($ ('# kitty ') .length! = 0) {if ($ (' ($) '("hovering") == "yes") {// Be careful whatsoever your desired action ("hover"); }}}};}, 3000); $ ('# kitty'). Mousecenter (function () {$ (this). CSS ({'transform': 'scale (1.5)', 'transition': '500ms transform Do '}) // Set the data parameter $ (this) .data ("hovering", "yes")}} .moveleave (function () {$ (this). Css ({' transform ':' s El (1) ',' transition '' Conversion 500 ms'}); // parameter when leaving the mouse $ (this). Data ("hovering", "");});
Comments
Post a Comment