在jQuery中创建逃跑按钮 [英] Make a run away button in jQuery
本文介绍了在jQuery中创建逃跑按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个带有简单按钮的页面,当用户试图单击该页面时,该按钮会远离用户.让我们称之为逃跑"按钮吗?
I wanted to create a page with a simple button which runs away from the user when he tries to click it. Lets call it the Run away button?
是否有一个简单的"jQuery"代码段可以让我做同样的事情?
Is there a simple 'jQuery' snippet which will allow me to do the same?
关于, 卡兰·米斯拉(Karan Misra)
Regards, Karan Misra
推荐答案
$('button').hover(function()
{
$(this).css('top', rand(1,1000) + 'px').css('left', rand(1,1000) + 'px');
});
不需要插件.
这篇关于在jQuery中创建逃跑按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文