<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script type="text/javascript" src="js/jquery-1.12.4.js"></script>
<style>
div{
height: 10px;
width: 10px;
margin: 100px auto;
background-color: #007997;
transition:height 2s linear;
}
div.active{
margin: 200px auto;
width: 200px;
height: 50px;
}
</style>
<script>
$(function(){
console.log($("div").height());
setTimeout(function () {
$("div").addClass("active");
setTimeout(function () {
$("div").height(10);
},2000);
// $("input").clear("hello");
clearValue( $("input"),"2016");
},1000);
});
$.fn.clear = function(val){
$(this).val(val);
};
function clearValue($target,val){
$target.val("123");
}
</script>
</head>
<body>
<input type="text" value="12345">
<div></div>
</body>
</html>
CSS transition的用法
最新推荐文章于 2025-03-22 01:30:05 发布
本文介绍了一个使用jQuery实现的简单网页元素过渡效果案例。页面包含一个通过点击事件触发其大小变化的div元素,该元素在点击后会经历一个两秒的过渡期,期间其高度和宽度将发生变化。此外,文章还涉及了如何使用jQuery来自定义输入框的默认值。
785

被折叠的 条评论
为什么被折叠?



