两个小效果(美女系列..)1.纯css和css3实现;2.jquery实现.

来源:互联网 发布:java 服务器文件同步 编辑:程序博客网 时间:2024/05/23 01:15

恩 录出来有些卡...

第一个:


第二个:


下面跟上代码:

<!doctype html><html><head><meta charset="utf-8"><title></title><style>*{margin:0;padding:0}body{background: #272727;}#box #uu li a img{width:200px;height:200px;float: left;box-shadow: 2px 2px 5px;}#box #uu li{list-style: none;float: left;background: blue;margin:5px;position: relative;overflow: hidden;}#box{width:420px;height:420px;border-radius: 5px;background: #EFFDF0;margin:100px auto;border:1px solid #F7F8F9 ;}.wz{position: absolute;top:50%;left:50%;background: rgba(0,0,0,0.5);color:white;text-align: center;width:200px;margin-left:-100px;margin-top:-50px;height:0px;line-height: 100px;transform: rotate(60deg);transition:0.5s;opacity: 0;z-index: 5;}#box #uu li:hover .wz{height:100px;opacity: 1;transform: rotate(0deg)}.zuo{width:300px;height:300px;position:absolute;left:0;top:0;background:rgba(150,50,100,0.5) ;transform: rotate(45deg) translateX(-370px);transition:0.5s 0.1s}#box #uu li:hover .zuo{transform:rotate(45deg) translateX(-190px);}.you{width:300px;height:300px;position:absolute;left:0;top:0;background:rgba(150,50,100,0.5) ;transform: rotate(45deg) translateX(370px);transition:0.5s 0.1s}#box #uu li:hover .you{transform:rotate(45deg) translateX(50px);}</style></head><body><div id="box"><ul id="uu"><li><div class="zuo"></div><a href=""><img src="img/u=1384767500,2445353950&fm=23&gp=0.jpg"/></a><div class="wz">one</div><div class="you"></div></li><li><div class="zuo"></div><a href=""><img src="img/u=1388309047,3011173800&fm=23&gp=0.jpg"/></a><div class="wz">two</div><div class="you"></div></li><li><div class="zuo"></div><a href=""><img src="img/u=1886826922,2894415161&fm=23&gp=0.jpg"/></a><div class="wz">three</div><div class="you"></div></li><li><div class="zuo"></div><a href=""><img src="img/u=4124882609,3242334734&fm=23&gp=0.jpg"/></a><div class="wz">four</div><div class="you"></div></li></ul></div></body></html>

<!doctype html><html><head><meta charset="utf-8"><title></title><style>* {padding: 0;margin: 0}img {width: 400px;height: 240px;position: absolute;}#box {position: relative;width: 800px;height: 480px;margin: 90px auto;background: #66BF91;}.z {z-index: 5;}#box img:nth-child(1) {left: 0;top: 0}#box img:nth-child(2) {left: 400px;top: 0}#box img:nth-child(3) {left: 0;top: 240px}#box img:nth-child(4) {left: 400px;top: 240px}#box img:nth-child(5) {width: 450px;height: 280px;}</style><script src="js/jquery-3.2.0.min.js"></script><script src="js/jquery.easing.min.js"></script><script>$(function() {var zuo=($('#box').width()-$('.img').width())/2;var shang=($('#box').height()-$('.img').height())/2;$('.img.z').css({'left':zuo,'top':shang})$('.img').mouseenter(function() {if(!$('.img').is(':animated')){if(!$(this).hasClass('z')) {var x = $('.img.z').position().left;var y = $('.img.z').position().top;var wd = $('.img.z').width();var ht = $('.img.z').height();var xx = $(this).position().left;var yy = $(this).position().top;var wdd = $(this).width();var htt = $(this).height();$('.img.z').removeClass('z').stop().animate({'left': xx,'top': yy,'width': wdd,'height': htt}, 1000);$(this).addClass('z').stop().animate({'left': x,'top': y,'width': wd,'height': ht}, 1000)}}})})</script></head><body><div id="box"><img class="img" src="img/img0.jpg" /><img class="img" src="img/img1.jpg" /><img class="img" src="img/img2.jpg" /><img class="img" src="img/img3.jpg" /><img class="img z" src="img/img4.jpg" /></div></body></html>