JS and CSS3 Cool 3D album Show

Source: Internet
Author: User

<!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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.