カーソル位置に基づいてテキストを変更しようとしています。 動作していますが、変更の感度は速いです。 これを調整する方法があるかどうか、変更はそれほど速くないと思っていました。カーソル位置のテキストを変更する
var text = ['Orange', 'Banana', 'Strawberry', 'Melon']
$(document).mousemove(function(event) {
var randomItem = text[Math.floor(Math.random() * text.length)];
var div = $("#message");
div.stop().animate({
"opacity": "1"
}, 1, function() {
$(this).text(randomItem);
$(this).stop().animate({
"opacity": "1"
}, 1);
});
});
#message { font-size: 54px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="message">Move the mouse.</div>
NNICE。それはまさに私が探していたものです。ありがとうイダン:) – Dennis