问题
I remember seeing some website or script on the web about this funny / tricky button: Basically it's a button that is impossible to click. When mouseover, it moves randomly away.
Can someone point me to a source or show me few line of code to do that? Preferably using jQuery.
回答1:
This is probably what you are looking for, http://jsfiddle.net/9CDtE/4/
HTML
<button>button</button>
CSS
button{
position:absolute;
top:10px;
left:10px;
}
JS
$(function(){
$("button").on({
mouseover:function(){
$(this).css({
left:(Math.random()*200)+"px",
top:(Math.random()*200)+"px",
});
}
});
});
来源:https://stackoverflow.com/questions/11929687/tricky-button-moving-away-when-mouseover-in-javascript