<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>练习</title>
<script type="text/javascript" src="./js/swiper.min.js"></script>
<link rel="stylesheet" type="text/css" href="./css/swiper.min.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<style type="text/css">
.imgtype1{width: 200px;height: 200px;}
.imgtype2{width: 100px;height: 100px;}
</style>
</head>
<body>
<div id="images">
<img src="./images/pic01.jpg" />
<img src="./images/pic02.jpg" />
<img src="./images/pic03.jpg" />
<img src="./images/pic04.jpg" />
<img src="./images/pic01.jpg" />
</div>
<script>
$("img").each(function(res){
var imgnumber = $("img");
if (res > 1){
$(this).addClass("imgtype2");
}else{
$(this).addClass("imgtype1");
}
});
</script>
</body>
</html>
前两个图片使用样式一,后面的图片使用样式二
猜你喜欢
转载自blog.csdn.net/qq_37815596/article/details/81008213
今日推荐
周排行