<!doctype html>
<meta charset= "UTF" >
<title>js and CSS3 Cool 3D album show </title>
<style>
*{margin:0;padding:0;}
Body{background:url (img/bg.jpg); width:100%;height:100%;overflow:hidden;};
h1{width:277;height:76px;margin:30px Auto 0;}
. Xc-3d{width:100%;height:300px;background: #fff; margin-top:100px;position:relative;transform-style:preserve-3d ;/* Change 3d*/perspective:800px;//depth of field}
. xc-3d Img{position:absolute;-webkit-box-reflect:below 0-webkit-linear-gradient (Top,rgba (0,0,0,0.1), Rgba ( 0,0,0,0.5)); transition:1s;}
. xc-3d img. Forn{transform:rotatey (45deg); Transfromz ( -100px);}
. xc-3d img. Now{transform:rotatey (0deg); Transfromz (100px);}
. xc-3d img. Last{transform:rotatey ( -45deg); Transfromz ( -100px);}
</style>
<body>
<div class= "Xc-3d" >
</div>
<script src= "Js/jquery.js" ></script>
<script>
var imgl=$ (. xc-3d img). length;//represents a few img
var lastmin=math.floor (IMGL/2);//Take an integer down to get the middle initial intermediate serial number
for (Var i=0;i
if (i<lastmin) {
$ (". xc-3d img") EQ (1). addclass ("Forn");
}else if (i>lastmin) {
$ (". xc-3d img") EQ (1). addclass ("last");
}else{
$ (". xc-3d img") EQ (1). addclass ("Now");
}
};
};
Control position
function Mind () {
Browser width
var w_l=$ (window). width ();
var _left=w_l/2)-$ (". Xc-3d.now"). Width/2;
$ (". Xc-3d img.now"). CSS ({left:_left+ "px"});
for (Var i=0;i
Very important
$ (". Xc-3d img.now"). EQ (i). CSS (left:_left-(lastmin-i) *150+ "px");
};
Save the left.
Left[i]=parseint ($ (". xc-3d img"). EQ (i). CSS ("left");//Convert a string to a number
}
$ (. xc-3d img). Click (Funtion () {
Add Style
for (Var i=0;i
var nowmin=$ (this). index ();
if (i<nowmin) {
$ (". xc-3d img") EQ (1). Removeclass (). addclass ("Forn");
}else if (i>nowmin) {
$ (". xc-3d img") EQ (1). Removeclass (). addclass ("last");
}else{
$ (". xc-3d img") EQ (1). Removeclass.addclass ("Now");
};
};;
Determine location
for (Var i=0;i
left[i]-= (nowmin-lastmin) *150;//why
Very important
$ (". xc-3d img"). EQ (i). css ({left:left[i]+ "px"});
};
lastmin=nowmin;//current and initial values alternating
})
</script>
</body>
CSS compatible, JS compatible, Render, bottom, kernel compatible
1 projection
JS and CSS3 Cool 3D album Show