jq基础知识

###事件模拟
$("input").trigger("click");
####hover()
-格式  hover(fn1,fn2);等效 onmouseover+onmouseout
 ####动画
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="../js/jquery-1.4.2.js"></script>
<style type="text/css">
img{
	width: 200x;
	height: 200px;
	position: relative;
}
</style>
<script type="text/javascript">
$(function(){
	$("input").click(function(){
		if($(this).val()=="隐藏"){
			$("img").hide(3000);
		}else if($(this).val()=="显示")
			$("img").show(3000,function(){
				$("img").hide(3000,function(){
					$("img").show(1000);
				});
			});
		else if($(this).val()=="上滑"){
			$("img").slideUp(3000);
		}
		else if($(this).val()=="下滑"){
			$("img").slideDown(3000);
		}
		else if($(this).val()=="淡出"){
			$("img").fadeOut(3000);
		}
		else if($(this).val()=="淡入"){
			$("img").fadeIn(3000);
		}
		else{
			$("img").animate({"left":"250px"},1000).animate({"top":"250px"},1000)
		.animate({"left":"0"},1000).animate({"top":"0"},1000)
		.animate({"width":"400px","height":"300px"},1000)
		.animate({"width":"200px","height":"200px"},1000)
		}
	})
	$('img').hover(function(){
		$(this).animate({"width":"220px","height":"250px"},500),
		function(){
			$(this).animate({"width":"200px","height":"170px"},500)
		}
	})	
}) 
</script>
</head>
<body>
<input type="button" value="隐藏">
<input type="button" value="显示">
<input type="button" value="上滑">
<input type="button" value="下滑">
<input type="button" value="淡出">
<input type="button" value="淡入">
<input type="button" value="自定义">
<hr>
<img alt="" src="../img/4.jpg">
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值