I am trying to change a text based on the cursor position. It is working but the change sensitivity is way to fast. So I was wondering if there is a way to adjust this, that the change isn't that fast.
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>