博客列表 >动态相册

动态相册

其琛的博客
其琛的博客原创
2018年04月11日 17:42:07640浏览

代码如下

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="../jquery/jquery.js"></script>
<script type="text/javascript" src="js/作业16.js"></script>
</head>
<body>
<form action="api/check.php" method="post">
<fieldset>
<legend>用户登陆</legend>
<p>
<label for="email">邮箱:</label>
<input type="text" name="email" id="email">
</p>
<p>
<label for="password">密码:</label>
<input type="password" name="passwordl" id="password">
</p>
<p>
<button>登陆</button>
<span id="tips" style="font-size: 1.1em;font-weight: bolder;color: red"></span>
</p>
</fieldset>
</form>
</body>
</html>
$(document).ready(function(){
	$('button.add').on('click',function(){
		// 获取图片信息
		var img =$('#img').val()
		// console.log(img)
		if (img.length ==0) {
			alert('不能为空')
			$('#img').focus()
			return false
		}
		// 获取图片类型
		var imgtype =$(':radio:checked').val()
		 // console.log(imgtype)
		 // 判断是否参加阴影
		 var shadow='none'
		 if ($(':selected').val()==4) {
		 	shadow='5px 5px 5px #666'
		 }
		 // console.log(shadow)
		 // 创建图片
		 var img1 =$('<img>')
		 // console.log(img1)
		 .prop('src',img)
		 .width(150)
		 .height(150)
		 .css({			
					'border-radius': imgtype,
					'box-shadow': shadow
				})
		//创建三个按钮
		var before = $('<button>').text('前进')
		var after = $('<button></button').text('后退')
		var remove = $('<button></button').text('删除')
		//添加按钮到图片下面
		var li = $('<li>').append(img1,before,after,remove)
		//第三步: 将图片添加到页面中		
		li.appendTo('ul')
        //前进
		before.click(function() {
			$(this).parent().prev().before($(this).parent())
		});
		//后退
		after.click(function() {
			$(this).parent().next().after($(this).parent())
		});

		//删除
		remove.click(function() {
			$(this).parent().remove()
		});
	})
})
.box{
	background-color: #e0e0e0;
	width: 630px;
}
.top{
	margin-left: 50px;
	text-align: center;
	background-color: #c0c0c0;
	width: 500px;
	height: 80px;
}
.add {
	width: 100px;
	height: 30px;
	border: none;
	cursor: pointer;
	background-color: black;
	color: white;
	margin-left: 50px;
}
.add:hover {
	font-size: 1.1em;
	background-color: #180000;
}
.bottom{
	overflow: hidden;
}
.bottom ul {
	padding: 0;
	margin: 0;
}
.bottom ul li {
	list-style-type: none;
	float: left;
	margin-left: 20px;
	margin-bottom: 10px;
	width: 150px;
	height: 200px;
	text-align: center;
}

效果如图1F}JA66S)PFO3GI2VS6(7YK.png

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议