jquery - Hover + Mousemove, how could I reduce the repeated code? -
I looked at StakeVarf Flo, and I'm not a programmer, I'm sure that I have some basic knowledge, and jquery context is unavailable. The website is not helping it. I have to use both mousewov and hover, to find out that it is running on a mouse (which can be an animation) at the top of an image. My problem is that I want to reduce the same code I am using to mystuff , but at the same time I have the option of myotherstuff . How should I write codes? $ ("# central .img"). Mousemove (function () {* mystuff *}); $ ("#incent.img"). Hover (function () {* mystuff *}, function () {* myotherstuff *}); Thanks for your help Reuse. function myfunction () {* mystuff *} $ ("# central .img"). Mousemove (myfunction); $ ("#incent.img"). Hover (myfunction, function () {* myotherstuff *});