亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Jquery的事件方法

??? 2018-11-20 22:58:07 187
????:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <script type="text/javascript" src="jquery-3
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title></title>
	<script type="text/javascript" src="jquery-3.3.1.min.js"></script>
</head>
<body>
<script type="text/javascript">
	a1=1,a2=1,a3=1,a4=1,a5=1,a6=1;a7=1,a8=1,a9=1;
	$(document).ready(function(){
		$('div.over').mouseover(function(){
			$('.over span').text(a1++);
		})//不論鼠標(biāo)指針穿過(guò)被選元素或其子元素,都會(huì)觸發(fā) mouseover事件。
		$('div.enter').mouseenter(function(){
			$('.enter span').text(a2++);
		})//只有在鼠標(biāo)指針穿過(guò)被選元素時(shí),才會(huì)觸發(fā)mouseenter 事件。
		$('div.leave').mouseleave(function(){
			$('.leave span').text(a3++);
		})//只有再鼠標(biāo)離開(kāi)被選元素時(shí),才會(huì)觸發(fā)mouseleave的事件。
		$('div.move').mousemove(function(){
			$('.move span').text(a4++);
		})//不論鼠標(biāo)指針在被選元素或其子元素上移動(dòng),都會(huì)觸發(fā)mousemove事件。
		$('div.out').mouseout(function(){
			$('.out span').text(a5++);
		})//不論鼠標(biāo)指針在被選元素或其子元素上離開(kāi),都會(huì)觸發(fā)mouseout事件。
		$('div.down').mousedown(function(){
			$('.down span').text(a6++);
		})//不論鼠標(biāo)指針在被選元素或其子元素上按下,都會(huì)觸發(fā)mousedown事件。
		$('div.up').mouseup(function(){
			$('.up span').text(a7++);
		})//不論鼠標(biāo)指針在被選元素或其子元素上松開(kāi),都會(huì)觸發(fā)mouseup事件。
		$(window).resize(function(){
			$('.resize span').text(a8++);
		})//當(dāng)調(diào)整當(dāng)前瀏覽器窗口大小時(shí),會(huì)觸發(fā)resize事件
		$(document).mousemove(function(a9){
			$('.weizi span').text('x坐標(biāo):'+a9.pageX+'/'+'y坐標(biāo):'+a9.pageY);
		})//當(dāng)前鼠標(biāo)移動(dòng)的坐標(biāo)位置
	})

</script>
<div class="over" style="width: 30%;background-color: #ccc;float: left;padding: 50px">
	<h2 style="background-color: white">鼠標(biāo)移動(dòng)上去 mouseover事件觸發(fā)次數(shù): <span></span>次</h2>
</div>
<div class="enter" style="width: 30%;background-color: #ccc;float: right;padding: 50px">
	<h2 style="background-color: white">鼠標(biāo)移動(dòng)上去 mouseenter事件觸發(fā)次數(shù): <span></span>次</h2>
</div>
<div class="leave" style="width: 30%;background-color: #ccc;float: left;padding: 50px;margin-top: 50px">
	<h2 style="background-color: white">鼠標(biāo)指針離開(kāi) mouseleave事件觸發(fā)次數(shù): <span></span>次</h2>
</div>
<div class="move" style="width: 30%;background-color: #ccc;float: right;padding: 50px;margin-top: 50px">
	<h2 style="background-color: white">鼠標(biāo)指針移動(dòng) mousemove事件觸發(fā)次數(shù): <span></span>次</h2>
</div>
<div class="out" style="width: 30%;background-color: #ccc;float: left;padding: 50px;margin-top: 50px">
	<h2 style="background-color: white">鼠標(biāo)指針離開(kāi) mouseout事件觸發(fā)次數(shù): <span></span>次</h2>
</div>
<div class="down" style="width: 30%;background-color: #ccc;float: right;padding: 50px;margin-top: 50px">
	<h2 style="background-color: white">鼠標(biāo)在元素上按下 mousedown事件觸發(fā)次數(shù): <span></span>次</h2>
</div>
<div class="up" style="width: 30%;background-color: #ccc;float: left;padding: 50px;margin-top: 50px">
	<h2 style="background-color: white">鼠標(biāo)在元素上松開(kāi) mouseup事件觸發(fā)次數(shù): <span></span>次</h2>
</div>
<div class="resize" style="width: 30%;background-color: #ccc;float: right;padding: 50px;margin-top: 50px">
	<h2 style="background-color: white">瀏覽器窗口大小被調(diào)整 resize事件觸發(fā)次數(shù): <span></span>次</h2>
</div>
<div class="weizi" style="width: 93%;background-color: #ccc;padding: 50px;margin-top: 50px;float: left">
	<h2 style="background-color: white;padding: 30px">當(dāng)前鼠標(biāo)位置: <span></span></h2>
</div>
</body>
</html>


mouseover() 當(dāng)鼠標(biāo)指針位于元素上方會(huì)發(fā)生mouseover事件

//不論鼠標(biāo)指針穿過(guò)被選元素或其子元素,都會(huì)觸發(fā) mouseover事件。


mouseenter() 當(dāng)鼠標(biāo)指針穿過(guò)元素時(shí)會(huì)發(fā)生事件

//只有在鼠標(biāo)指針穿過(guò)被選元素時(shí),才會(huì)觸發(fā)mouseenter 事件。


mousemove()  當(dāng)鼠標(biāo)指針在指定的元素中移動(dòng)時(shí),發(fā)生事件

//不論鼠標(biāo)指針在被選元素或其子元素上移動(dòng),都會(huì)觸發(fā)mousemove事件


mouseleave()  當(dāng)鼠標(biāo)指針離開(kāi)元素時(shí)

//只有再鼠標(biāo)離開(kāi)被選元素時(shí),才會(huì)觸發(fā)mouseleave的事件。


mouseout()   當(dāng)鼠標(biāo)指針從元素上移開(kāi)時(shí)

//不論鼠標(biāo)指針在被選元素或其子元素上離開(kāi),都會(huì)觸發(fā)mouseout事件。


mousedown()  當(dāng)鼠標(biāo)指針移動(dòng)帶元素上方按下鼠標(biāo)按鍵時(shí)

//不論鼠標(biāo)指針在被選元素或其子元素上按下,都會(huì)觸發(fā)mousedown事件。


mouseup()  當(dāng)在元素上松開(kāi)鼠標(biāo)按鍵時(shí)

//不論鼠標(biāo)指針在被選元素或其子元素上松開(kāi),都會(huì)觸發(fā)mouseup事件。


resize()  當(dāng)調(diào)整當(dāng)前瀏覽器窗口大小時(shí)

//當(dāng)調(diào)整當(dāng)前瀏覽器窗口大小時(shí),會(huì)觸發(fā)resize事件


pageX()  屬性是鼠標(biāo)指針的位置,相當(dāng)于文檔的左邊緣 event.pageX    event:必須 參數(shù)來(lái)自事件綁定函數(shù)

pageY()  屬性是鼠標(biāo)指針的位置,相當(dāng)于文檔的上邊緣 event.pageY    event:必須 參數(shù)來(lái)自事件綁定函數(shù)


??? ??

?? ??