Back in my Flash days, animations seemed to just work. I am finding that jQuery hover and animate events are not as forgiving.
I have a web page with a grid of images. Each image has a jQuery hover event. The issue I was having with this is that when I would quickly hover from image-to-image or swipe the cursor across the screen, the hover effects, collectively, would look weird and sometimes would not fire properly at all.
The solution (thanks to Tom for providing it!), was to add the stop(true,true) event to each animation as follows:
// jQuery
$('.myclass').hover(function(){
$(this).stop(true, true).animate({opacity: 0}, 150);
}, function(){
$(this).stop(true, true).animate({opacity: .8}, 150);
});
More posts from themightymo.com
How to change all permalink slugs on a custom post type to “post id” rather than “post title”
Today I needed to change the url slug of a custom post type from /cpt-slug/%post-title%/ to /cpt-slug/%post-id%/. There were thousands of solutions on the web explaining how to change the “cpt-slug” portion of the url, but I couldn’t find a simple solution to change the last part of the url. Well here it is! The…
My Main Issue with Clickup
Clickup integrates with everything. It’s simple to use. But there’s one thing that drives me crazy: Their user interface (UI) assumes the conversation we have around to-dos is NOT important. Clickup‘s UI assume the task writeup stuff (uploaded docs, description, links, etc.) is more important than the conversation about that stuff. In my experience, the…
How to merge two folders, including all sub-folders and files, on Mac
Today I had an issue where I needed to merge two folders, each of which contained many sub- and sub-sub folders that had lots of images. After a lot of trial-and-error and some Googling, I found the best solution is to use the “ditto” command in Terminal like this: That’s it! Hat tip to AppleInsider.