JavaScript tutorial : javascript mouse movement events

preview_player
Показать описание
tutorial about javascript mouse moving event
source code:
style:
.circle {
width: 15px;
height:15px;
position: absolute;
border:1px solid #000;
border-radius: 50%;
}

script:

function animatedcircles (event){
}
Рекомендации по теме
Комментарии
Автор

<!DOCTYPE html>
<html>
<head>
<title>mouse move</title>
<style type="text/css">
.circle {
width: 15px;
height:15px;
position: absolute;
border:1px solid #000;
border-radius: 50%;
}
</style>
</head>
<body>

<script type="text/javascript">
document.body.style.cursor = 'none';
document.onmousemove = animatedcircles;

function animatedcircles (event){
var circle =
circle.setAttribute("class", "circle");

circle.style.left = event.clientX+'px';
circle.style.top = event.clientY+'px';
circle.style.transition = 'all 1s linear 0s';
circle.style.left = circle.offsetLeft -20+'px';
circle.style.top = circle.offsetLeft -20+'px';
circle.style.width = '100px';
circle.style.height = '100px';
circle.style.borderwidth = '5px';
circle.style.opacity = 0;
}
</script>
</body>
</html>

nihadtechvlog
join shbcf.ru