摘要:<!DOCTYPE html><html><head> <title>hover和toggle事件切換</title> <meta charset="utf-8"> <script type="text/javascript" src="../jquery-3.4.0.m
<!DOCTYPE html>
<html>
<head>
<title>hover和toggle事件切換</title>
<meta charset="utf-8">
<script type="text/javascript" src="../jquery-3.4.0.min.js"></script>
<script >
$(document).ready(function(){
$('.one').addClass('bb aa')
$('.one').removeClass('bb')
$('.one').text('hello world')
$('.one').html('<h1>hello world!</h1>')
$('.one').dblclick(function(){
$(this).css('background','red')
})
a=0
$(window).resize(function(){
$('b').text(':'+a++)
})
$('.two').hover(
function(){
$(this).addClass('bb')
},
function(){
$(this).css('color','#fff')
})
$('button').click(function(){
$('.there').toggle().css('background','pink')
})
})
</script>
<style type="text/css">
div{width: 200px;height: 200px;background: lightblue}
.aa{background: pink;font-size: 16px;}
.bb{color: red}
</style>
</head>
<body>
<div class="one">塊級元素哦</div>
<div class="two">
頁面被調(diào)整大小<b></b>
</div>
<br>
<div class="there" style="display: none;"></div>
<button>切換按鍵</button>
</body>
</html>
批改老師:查無此人批改時(shí)間:2019-04-29 09:17:35
老師總結(jié):完成的不錯(cuò)。jq每行語句結(jié)束要增加;號。繼續(xù)加油。