JS 实现3D立体效果的首页轮播图(瞬间让你的网站高大上,逼格满满)

本文分享了一种使用JavaScript实现3D立体效果的首页轮播图,通过提供的源代码,能够帮助开发者为网站增添高大上的视觉体验,提升页面的逼格。
摘要由CSDN通过智能技术生成

这里写图片描述

还是那句话,废话少说,直接上源代码:http://download.csdn.net/detail/cometwo/9387901

<html>
<head>
<title>JS 实现3D立体效果的图片幻灯切换</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style>
html {
    background:#000}
body, ul {
    margin:0;padding:0}
li {
    list-style:none}
img {
    border:none;display:block}
.slide-wp {
width: 500px;
height: 300px;
overflow: hidden;
position: absolute;
left: 50%;
top: 50%;
margin-left: -250px;
margin-top: -150px;
}
.nav-wp {
position: absolute;
background: #ccc;
top: 50%;
margin-top: 170px;
left: 50%;
margin-left: -100px;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
padding: 0 20px 6px 10px;
_padding: 0 20px 2px 10px;
}
.nav li {
float: left;
margin-left: 10px;
font-size: 20px;
font-weight: bold;
font-family: tahoma;
color: #22739e;
cursor: pointer;
height: 22px;
}
.nav li.cur{
    color: #ff7a00}
.next {
position:absolute;
top: 0;
left: 160px;
padding: 4px 8px;
color: #ff7a00;
background: #ccc;
height: 20px;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
cursor: pointer;
}
</style>
</head>
<body>
<h2 style="color:#fff">对于使用IE6的同学看到的斑点,我只能表示很无奈。。。</h2>
<div id="slider" class="slide-wp">
<ul>
<li><a href="http://www.newxing.com/" target="_blank"><img src="http://www.newxing.com/img/450/1.jpg"  alt="" /></a></li>
<li><a href="http://www.newxing.com/" target="_blank"><img src="http://www.newxing.com/img/450/2.jpg"  alt="" /></a></li>
<li><a href="http://www.newxing.com/" target="_blank"><img src="http://www.newxing.com/img/450/3.jpg"  alt="" /></a></li>
<li><a href="http://www.newxing.com/" target="_blank"><img src="http://www.newxing.com/img/450/4.jpg"  alt="" /></a></li>
<li><a href="http://www.newxing.com/" target="_blank"><img src="http://www.newxing.com/img/450/5.jpg"  alt="" /></a></li>
</ul>
</div>
<div class="nav-wp">
<ul id="nav" class="nav">
<li onclick="mySlider.pos(0)"></li>
<li onclick="mySlider.pos(1)"></li>
<li onclick="mySlider.pos(2)"></li>
<li onclick="mySlider.pos(3)"></li>
<li onclick="mySlider.pos(4)"></li>
</ul>
<a class="next" onclick="mySlider.move()">next</a>
</div>
<script type="text/javascript">
var HR = {
 $ : function(i) {
    return document.getElementById(i)},
 $$ : function(c, p) {
    return p.getElementsByTagName(c)},
 ce : function(i, t) {
    
  var o = document.createElement(i);
  t.appendChild(o);
  return o;
 }
};
HR.slider3D = function () {
    
 var init = function (o) {
    
  this.o = o;
  var wp = HR.$(o.id), ul = HR.$$('ul', wp)[0], li = this.li = HR.$$('li', ul);
  this.l = li.length;
  this.w = wp.offsetWidth;
  this.h = wp.offsetHeight;
  this.at = o.auto? o.auto : 4;
  var con = this.con = HR.ce('div', wp);
  con.style.cssText = 'position:absolute;left:0;top:0;width:'+this.w+'px;height:'+this.h+'px';
  ul.style['display'] = 'none'; 
  this.a1 = HR.ce('a', con); 
  this.a1.style.cssText = 'position:absolute;left:0;t
  • 6
    点赞
  • 43
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值