[239189] arrow

210 Conversations | 2,776 Posts + (501 from users, 2,275 from bots) | 4 Uploaded Images +

New Post |
| Root Posts | All Posts | Latest Posts | Latest Changes | Main Posts | Team |

By Kritishankar02. Created 2020/11/21 14:27:20

Post type: HTML

Show as HTML page | Reply | Duplicate | Rename | Raw Text

<!doctype html>
<html>
	<head>
		<style>
			body{
	
	margin:0;
	
}

.box{
	position: absolute;
	top:50%;
	left:50%;
	transform: translate(-50%,-50%);
}

.box span{
	display: inline-block;
	width: 20px;
	height: 20px;
	border-bottom: 3px solid blue;
	border-right: 3px solid blue;
	transform: 	rotate(45deg);
	margin:-13px;
	animation: animate 2s infinite;
}

.box span:nth-child(2){
	animation-delay: -0.1s;
	
}

.box span:nth-child(3){
	animation-delay: -0.3s;
	
}


@keyframes animate{
	
	0%{
		opacity:0;
		transform: rotate(45deg) translate(-20px,-20px);
	}
	
	50%{
		opacity:1;
	}
	100%{
		opacity:2;
		transform: rotate(45deg) translate(20px,20px);
		}
	}
	
	
		</style>
	</head>
	<body>
	<p>Click on the arrows to see the animation</p>
		<div class="box">
			<span></span>
			<span></span>
			<span></span>
		</div>
	</body>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
	<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
<script> 
$(document).ready(function(){
  $(".box").click(function(){
			Math.atan()
			var p = $(".box").position()
			$('.box span').css({"transform": "rotate("+ Math.atan2(p.left-250,p.top-250)+Math.PI/2+"rad)" });
			$(".box").animate({left: '250px' , top:'100px',display: 'block'});
			
		
		
  });
});
</script> 	
</html>