慕尼黑8414315
2016-11-23 14:35
width: "toggle" 是什么意思?
显示或者隐藏
toggle是切换显示show和隐藏hide,如果内容显示,width: "toggle" 将会结果隐藏DIV及内容;如果内容隐藏,width: "toggle" 将会结果显示DIV及内容;
toggle是一个方法。具体看这个链接: http://www.imooc.com/code/10169 .通过改变CSS的display属性,匹配的元素将被显示或隐藏。
最好的办法就是自己试试
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://apps.bdimg.com/libs/jquery/1.6.4/jquery.min.js"></script>
<style>
div {position: absolute;width: 100px; height: 100px; background: green;}
</style>
</head>
<body>
<input type="button" value="toggle"/>
<div></div>
<script>
$("input").click(function () {
$("div").animate({
width: "toggle"
})
})
</script>
</form>
</body>jQuery基础(四)—动画篇
85034 学习 · 268 问题
相似问题