<script type="text/javascript">
function f1(){
//隐藏
$("div").hide();//display:none
//document.getElementById('id').style.display="none";
}
function f2(){
//显示
$("div").show();//display:block
}
function f3(){
$("div").toggle();
}
</script>
<style type="text/css">
div {width:300px; height:200px; background-color:blue;}
</style>
<body>
<div>duck and dog</div>
<input type="button" value="隐藏" onclick="f1()" />
<input type="button" value="显示" onclick="f2()" />
<input type="button" value="开关效果" onclick="f3()" />
</body>
<script type="text/javascript">
function f1(){
//隐藏
$("div").slideUp(3000,function(){
alert('我消失了,你能看到么');
});
}
function f2(){
//显示
$("div").slideDown(3000,function(){
alert('我又回来了');
});//display:block
}
function f3(){
$("div").slideToggle(1000);
}
$(function(){
//气缸滑动效果
//setInterval("f3()",1000);
});
</script>
<style type="text/css">
div {width:300px; height:200px; background-color:blue;}
</style>
<body>
<div>duck and dog</div>
<input type="button" value="隐藏" onclick="f1()" />
<input type="button" value="显示" onclick="f2()" />
<input type="button" value="开关效果" onclick="f3()" />
</body>
<script type="text/javascript">
function f1(){
//隐藏
$("div").fadeOut(4000);
}
function f2(){
//显示
$("div").fadeIn(4000);
$("#two").fadeTo(2000,0.3);
}
function f3(){
$("div").fadeToggle(2000);
}
</script>
<style type="text/css">
div {width:300px; height:200px; background-color:blue;}
</style>
<body>
<div id = "two">duck and dog</div>
<input type="button" value="隐藏" onclick="f1()" />
<input type="button" value="显示" onclick="f2()" />
<input type="button" value="开关效果" onclick="f3()" />
</body>
$().animate(css效果参数[,时间][,回调函数]);
<script type="text/javascript">
function f1(){
//文字大小、文字粗体、div本身宽度和高度
//font-size background-color color
console.log($("div"));
//jquery对象调用完毕css方法本身还是一个jquery对象
//说明css方法执行完毕有return this关键字
console.log($("div").css('font-weight','bold').css("background-color",'pink'));
var jn = {'font-size':'30px',width:'400px',height:'300px'};
$("div").css('font-weight',"bold").css("background-color","pink").css("color","white").animate(jn,2000);
//$("div").animate(jn,2000);
}
</script>
<style type="text/css">
div {width:300px; height:200px; background-color:blue; }
</style>
<body>
<div>duck and dog</div>
<input type="button" value="设置" onclick="f1()" />
</body>
(function(){
$("#panel").click(function(){
$(this).animate({left: "+=500px"}, 3000);
})
})</span>
$(function(){
$("#panel").click(function(){
$(this).animate({left: "500px",height:"200px"}, 3000);
})
})
$(function(){
$("#panel").click(function(){
$(this).animate({left: "500px"},3000)
.animate({height:"200px"},1000);
})
})
$(function(){
$("#panel").css("opacity",0.5);//设置不透明度
$("#panel").click(function(){
$(this).animate({left: "400px",height:"200px",opacity:"1"},3000)
.animate({top:"200px",width:"200px"},3000)
.fadeOut(1000);
})
})
$(function(){
$("#panel").css("opacity",0.5);//设置不透明度
$("#panel").click(function(){
$(this).animate({left: "400px",height:"200px",opacity:"1"},3000)
.animate({top:"200px",width:"200px"},3000,function(){$(this).css("border","5px solid blue")});
})
})
<style type="text/css">
*{margin:0;padding:0;}
body { font-size: 13px; line-height: 130%; padding: 60px }
#panel { width: 60px; border: 1px solid #0050D0 ;height:22px;overflow:hidden;}
.head { padding: 5px; background: #96E555; cursor: pointer;width: 300px;}
.content { padding: 10px; text-indent: 2em; border-top: 1px solid #0050D0;display:block; width:280px;}
</style>
<script src="../../../scripts/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$("button:eq(0)").click(function () {
$("#panel")
.animate({height : "150" } , 2000 )
.animate({width : "300" } , 2000 )
.hide(3000)
.animate({height : "show" , width : "show" , opacity : "show" } , 2000 )
.animate({height : "500"} , 2000 );
});
$("button:eq(1)").click(function () {
$("#panel").stop();//停止当前动画,继续下一个动画
});
$("button:eq(2)").click(function () {
$("#panel").stop(true);//清除元素的所有动画
});
$("button:eq(3)").click(function () {
$("#panel").stop(false,true);//让当前动画直接到达末状态 ,继续下一个动画
});
$("button:eq(4)").click(function () {
$("#panel").stop(true,true);//清除元素的所有动画,让当前动画直接到达末状态
});
})
</script>
<body>
<button>开始一连串动画</button>
<button>stop()</button>
<button>stop(true)</button>
<button>stop(false,true)</button>
<button>stop(true,true)</button>
<div id="panel">
<h5 class="head">三国杀杀天下</h5>
<div class="content">
夏侯惇的眼睛,陆逊的联营,郭嘉司马深深的基情
</div>
</div>
</body>
</html>
if(!$(element).is(":animated")){
//添加新的动画
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有