<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml&...
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Examples</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<script type="text/javascript" src="../js/jquery-3.1.1.js"></script>
<style>
*{
margin: 0px;
padding: 0px;
}
div {
width: 60px;
padding: 10px;
height: 50px;
float: left;
margin: 5px;
background: red;
cursor: pointer;
}
.mod {
background: blue;
cursor: default;
}
</style>
</head>
<body>
<div>d</div><div>d</div><div>d</div><div>d</div><div>d</div><script>var modWidth = 60; $("div").one("click", function() { $(this).outerWidth(modWidth).addClass("mod"); modWidth -= 6; });</script>
</body>
</html>h
运行后
不是很明白第一个点击之后为什么是40X50?40是怎么得来的?
波斯汪
相关分类