直接獲取任意對象的 $('.xx').css('x') 值都是0

<!-- 任意對象,直接獲取他們的 x , y 都是爲0;
$('#xxx').css('x','y'); -->
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<a href="">sdf</a>
	<div class="one">sdlkfsd</div>
	<div class="two">sdlkfsd</div>
	<div class="three">sdlkfsd</div>
	<div class="four">sdlkfsd</div>
	<div class="five">sdlkfsd</div>
	<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
	<script type="text/javascript">

		console.log($('.five').css('x'));
		console.log($('.five').css('y'));

		console.log($('.one').css('x'));
		console.log($('.one').css('y'));

		console.log($('.two').css('x'));
		console.log($('.two').css('y'));

	</script>
</body>
</html>
相關文章
相關標籤/搜索