上代码
(function(){ ???var $node; ???$node = $("<div style=‘position: absolute;‘ id=‘movePic‘><img src=‘https://imgsa.baidu.com/forum/w%3D580/sign=f9458d402da446237ecaa56aa8227246/01d6ecfe9925bc31c807f6a253df8db1cb137051.jpg‘ height=‘30px‘ width=‘30px‘>nice job</div>"); ???$("body").after($node); ???$("body").mousemove(function (e) { ???????$node.css("left", e.pageX + 20); ???????$node.css("top", e.pageY + 20); ???}); ???$("body").hover(function () { ???????$node.show(); ???}, function () { ???????$node.hide(); ???});})()
这些代码是独立的,直接粘贴就有效果
这样你的鼠标下就有了一个滑稽
本来像加到博客里的效果,结果发现不会。。。好像不支持jQuery特效,难道必须是纯css特效吗????
jquery实现图片跟随鼠标功能
原文地址:https://www.cnblogs.com/incredible-x/p/9631789.html