<html><head>
<title>腾讯娱乐图片预览的网站特效,已经进行了解析和优化,方便了解其html css原理。</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
body,ul,li,ol{list-style:none;padding:0px;margin:0px;}
.p27{
width: 640px;
height:1000px;
overflow:hidden;
margin:50px auto;
}
.p27List{
float: left;
border-top:1px solid #E0E0E0;
border-bottom:1px solid #E0E0E0;
position: relative;
}
.p27LContainer{
width:631px;
height:70px;
overflow: hidden;
background: #F2F2F2;
border-top:1px solid white;
border-bottom:1px solid white;
}
.p27LContent{
width: 10000px;
position: relative;
top:2px;
}
.p27LCol{
float:left;
width: 80px;
height:60px;
overflow:hidden;
margin:0px 0 0 4px;
border:3px solid #F2F2F2;
background: #F2F2F2;
text-align: center;
}
.p27LCol img{
height:100%;
}
.p27LCAct{
border:3px solid #2D96E9;
background:white;
}
.p27LLeft,.p27LRight{
position:absolute;
top:25px;
height:20px;
width:20px;
background:black;
opacity:0.5;
cursor:pointer;
}
.p27LLeft{
left:7px;
}
.p27LRight{
right:7px;
}
.p27Big{
float: left;
width: 100%;
position: relative;
}
.p27BImg{
width: 100%;
text-align: center;
}
/*图片上的 左右按钮*/
.p27BLeft,.p27BRight{
display:block;
width:50%;
height:100%;
position: absolute;
z-index:2;
top:0px;
}
.p27BLeft{
left:0;
}
.p27BRight{
right:0;
background:-30px 50px;
}
.p27BLeft span,.p27BRight span{
position:absolute;
top:50%;
margin-top:-22px;
width:24px;
height:43px;
background:url(./p27/s_gallery_2012110702.png) 0 -50px;
display:none;
}
.p27BLeft span{
left:10px;
}
.p27BRight span{
right:10px;
background-position:-30px -50px;
}
.p27BLeft:hover span,.p27BRight:hover span{
display:inline-block;
}
.P27BShop a:hover{
opacity: 0.8;
}
.P27Msg{
width: 100%;
height:30px;
line-height:30px;
background: black;
opacity: 0.6;
position: absolute;
top:0px;
left:0px;
z-index: 3;
}
.P27BShop{
width:160px;
height:30px;
background:rgba(0, 0, 0, 0.2);
border:1px solid #C5B9B6;
position: absolute;
bottom:10px;
left:50%;
margin-left:-80px;
z-index: 4;
}
.P27BSNum{
float: left;
width:80px;
height:30px;
line-height:30px;
color:white;
text-align:center;
}
.P27BSLeft,.P27BSAuto,.P27BSRight{
width: 10px;
height:20px;
display: block;
float:left;
background: url(./p27/s_gallery_2012110702.png);
margin:5px 10px 0 0;
opacity: 0.6;
}
.P27BSAuto{
width: 20px;
background: url(./p27/g_btn_play.png);
}
.P27BSRight{
background-position:-16px 0;
}
.P27BShop a:hover{
opacity: 0.8;
}
/*详细*/
.p27_Xx{
width:100%;
height:100%;
position:absolute;
left:0px;
top:0px;
z-index:5;
display:none;
}
.p27_Bg{
width:100%;
height:100%;
background:black;
opacity:0.8;
position:absolute;
top:0px;
left:0px;
z-index:1;
}
/*详细 底部操作部分*/
.p27_Xx_Shop{
width:100%;
height:110px;
position:absolute;
left:0px;
bottom:-82px;
z-index:5;
}
.p27_Xx_Title{
width:100%;
height:27px;
border-bottom:2px solid #232323;
text-align:center;
}
.p27_Xx_Title span{
display:inline-block;
width:82px;
height:29px;
line-height:29px;
text-align:center;
background:url(./p27/Mask_count.png);
color:white;
font-size:12px;
}
.p27_Xx_Title span i{
font-style:normal;
font-size:18px;
color:#0A96D0;
}
/*详细界面 底部操作部分的 按钮区域*/
.p27_Xx_Container{
height:80px;
width:100%;
background:#000000;
padding-top:10px;
}
.p27_Xx_BtnLeft,.p27_Xx_BtnRight{
position:absolute;
width:50%;
height:100%;
z-index:2;
background:;
}
.p27_Xx_BtnLeft{
left:0px;
}
.p27_Xx_BtnRight{
right:0px;
}
.p27_Xx_BtnLeft span,.p27_Xx_BtnRight span{
display:inline-block;
width:47px;
height:93px;
background:url(./p27/s_gallery_2012110702.png) 0 -96px;
position:absolute;
top:50%;
margin-top:-46px;
}
.p27_Xx_BtnLeft span{
left:5%;
}
.p27_Xx_BtnRight span{
background-position:0 -196px;
right:5%;
}
.p27_Xx_Colse{
width:54px;
height:54px;
background:url(./p27/s_gallery_2012110702.png) 0 -294px;
display:inline-block;
position:absolute;
z-index:5;
right:20px;
top:20px;
}
.p27_Xx_Colse:hover{
background:url(./p27/close1.png);
}
/*详细 大图*/
.p27_Xx_Image{
width:auto;
height:auto;
position:absolute;
z-index:4;
overflow:hidden;
}
.p27_Xx_Image img{
border:5px solid white;
border-bottom:0px;
}
/*大图 下方的文字*/
.p27_Xx_IMsg{
width:100%;
height:30px;
line-height:30px;
display:inline-block;
background:white;
}
.p27_Xx_IMsg a{
font-size:12px;
color:black;
float:right;
text-decoration:none;
margin-right:10px;
}
/*全屏 底部按钮区域*/
.p27_Xx_Content{
width:10000px;
height:100%;
position:relative;
}
.p27_Xx_Items{
float:left;
width:80px;
height:60px;
background:red;
overflow:hidden;
margin-left:4px;
border:3px solid #000;
text-align:center;
background:black;
}
.p27_Xx_Items img{
height:100%;
opacity:0.6;
}
.p27_Xx_Act{
border-color:#2D96E9;
background:white;
}
.p27_Xx_Act img,.p27_Xx_Items:hover img{
opacity:1;
}
/*详细大图 描述*/
.p27_Xx_Msg{
width:100%;
height:30px;
text-align:center;
position:absolute;
left:0px;
top:0px;
z-index:1;
color:white;
font-size:14px;
}
/*详细图片上的 左右按钮*/
.p27_Xx_ILeft,.p27_Xx_IRight{
width:50%;
position:absolute;
height:100%;
top:0px;
z-index:2;
}
.p27_Xx_ILeft{
cursor:url(./p27/arr_left.cur), auto;
left:0px;
}
.p27_Xx_IRight{
cursor:url(./p27/arr_right.cur), auto;
right:0px;
}
.p27_Xx_ILeft:hover,.p27_Xx_IRight:hover{
text-decoration:underline;
color:white;
}
a:focus {
outline: medium none;
}
/*自动播放按钮*/
.p27_Xx_Auto,.p27_Xx_Stop{
position:absolute;
top:10px;
right:10px;
display:inline-block;
width:20px;
height:20px;
background:url(./p27/g_btn_play.png);
z-index:3;
}
.p27_Xx_Stop{
display:none;
background:url(./p27/pause1.png) no-repeat center;
}
.p27_Xx_Auto:hover,.p27_Xx_Stop:hover{
opacity:0.8;
}
</style>
</head>
<body>
<div class="p27">
<div class="p27List">
<div class="p27LContainer">
<ul style="left: -360px;" class="p27LContent">
<li class="p27LCol"><a href="#" title=""><img src="1_files/1.jpg" alt=""></a></li>
<li class="p27LCol"><a href="#" title=""><img src="1_files/2.jpg" alt=""></a></li>
<li class="p27LCol"><a href="#" title=""><img src="1_files/3.jpg" alt=""></a></li>
<li class="p27LCol"><a href="#" title=""><img src="1_files/4.jpg" alt=""></a></li>
<li class="p27LCol"><a href="#" title=""><img src="1_files/5.jpg" alt=""></a></li>
<li class="p27LCol"><a href="#" title=""><img src="1_files/6.jpg" alt=""></a></li>
<li class="p27LCol"><a href="#" title=""><img src="1_files/7.jpg" alt=""></a></li>
<li class="p27LCol p27LCAct"><a href="#" title=""><img src="1_files/8.jpg" alt=""></a></li>
<li class="p27LCol"><a href="#" title=""><img src="1_files/9.jpg" alt=""></a></li>
<li class="p27LCol"><a href="#" title=""><img src="1_files/10.jpg" alt=""></a></li>
<li class="p27LCol"><a href="#" title=""><img src="1_files/11.jpg" alt=""></a></li>
<li class="p27LCol"><a href="#" title=""><img src="1_files/12.jpg" alt=""></a></li>
<li class="p27LCol"><a href="#" title=""><img src="1_files/13.jpg" alt=""></a></li>
<li class="p27LCol"><a href="#" title=""><img src="1_files/14.jpg" alt=""></a></li>
</ul>
</div>
<div class="p27LLeft"></div>
<div class="p27LRight"></div>
</div>
<div class="p27Big">
<div class="p27BImg"><img style="width: 100%;" src="1_files/8.jpg" alt=""></div>
<a class="p27BLeft" href="#" title=""><span></span></a>
<a class="p27BRight" href="#" title=""><span></span></a>
<div class="P27BShop">
<span class="P27BSNum">7/19</span>
<a class="P27BSLeft" href="#"></a>
<a class="P27BSAuto" href="#"></a>
<a class="P27BSRight" href="#"></a>
</div>
<div class="P27Msg"></div>
</div>
<div class="p27_Xx">
<div class="p27_Bg"></div>
<div class="p27_Xx_Shop">
<div class="p27_Xx_Title"><span><i>1</i>/2</span></div>
<div class="p27_Xx_Container">
<ul class="p27_Xx_Content">
<li class="p27_Xx_Items"><a href="#" title=""><img src="1_files/1.jpg" alt=""></a></li>
<li class="p27_Xx_Items"><a href="#" title=""><img src="1_files/2.jpg" alt=""></a></li>
<li class="p27_Xx_Items p27_Xx_Act"><a href="#" title=""><img src="1_files/3.jpg" alt=""></a></li>
<li class="p27_Xx_Items"><a href="#" title=""><img src="1_files/4.jpg" alt=""></a></li>
<li class="p27_Xx_Items"><a href="#" title=""><img src="1_files/5.jpg" alt=""></a></li>
<li class="p27_Xx_Items"><a href="#" title=""><img src="1_files/6.jpg" alt=""></a></li>
<li class="p27_Xx_Items"><a href="#" title=""><img src="1_files/7.jpg" alt=""></a></li>
<li class="p27_Xx_Items"><a href="#" title=""><img src="1_files/8.jpg" alt=""></a></li>
<li class="p27_Xx_Items"><a href="#" title=""><img src="1_files/9.jpg" alt=""></a></li>
<li class="p27_Xx_Items"><a href="#" title=""><img src="1_files/10.jpg" alt=""></a></li>
<li class="p27_Xx_Items"><a href="#" title=""><img src="1_files/11.jpg" alt=""></a></li>
<li class="p27_Xx_Items"><a href="#" title=""><img src="1_files/12.jpg" alt=""></a></li>
<li class="p27_Xx_Items"><a href="#" title=""><img src="1_files/13.jpg" alt=""></a></li>
<li class="p27_Xx_Items"><a href="#" title=""><img src="1_files/14.jpg" alt=""></a></li>
</ul>
<div class="p27_Xx_Left"></div>
<div class="p27_Xx_Right"></div>
</div>
</div>
<div class="p27_Xx_Aea">
<div class="p27_Xx_Image">
<img src="1_files/1.jpg" alt="">
<a class="p27_Xx_ILeft" href="#" title=""></a>
<a class="p27_Xx_IRight" href="#" title=""></a>
<a class="p27_Xx_Auto" href="#" title=""></a>
<a class="p27_Xx_Stop" href="#" title=""></a>
<span class="p27_Xx_IMsg"><a href="#" title="">感谢关注</a></span>
</div>
<div class="p27_Xx_Msg">描述...</div>
</div>
<a class="p27_Xx_BtnLeft" href="#" title=""><span></span></a>
<a class="p27_Xx_BtnRight" href="#" title=""><span></span></a>
<a class="p27_Xx_Colse" href="#" title=""></a>
</div>
</div>
<script type="text/javascript" src="1_files/jquery-1.js"></script>
<script type="text/javascript">
var btn=$('.p27LCol'),
ne=0;
//默认小图片按钮 挂接事件
$('.p27LCol').click(function(){
ne=$(this).index();
var n=ne,
lef=0;
//获取宽度参数
var kuan=$(this).width()+10,
zong=btn.length*kuan - $('.p27LContainer').width();
//修改小图片按钮样式
btn.removeClass('p27LCAct');
$(this).addClass('p27LCAct');
//获取移动距离
lef=(n-3)*(kuan);
//最左 最右判断
if( n <= 3 )lef=0;
if( lef>=zong )lef=zong+4;
//执行滚动
$('.p27LContent').stop(true).animate({ left:-lef });
//修改大图路径
$('.p27BImg img').attr('src',$(this).find('img').attr('src') );
if( $('.p27BImg img').width() > $('.p27BImg').width() )$('.p27BImg img').css({ width:'100%' });
}).eq(0).click();
//默认样式 挂接左右按钮事件
$('.p27LLeft').click(function(){
ne-=1;
if( ne<0 )ne=0;
btn.eq(ne).click();
});
$('.p27LRight').click(function(){
ne+=1;
if( ne>=btn.length )ne=btn.length-1;
btn.eq(ne).click();
});
$('.p27BRight').click(function(){
$('.p27LRight').click();
});
$('.p27BLeft').click(function(){
$('.p27LLeft').click();
});
$('.P27BSRight').click(function(){
$('.p27LRight').click();
});
$('.P27BSLeft').click(function(){
$('.p27LLeft').click();
});
//详细按钮 点击事件
var xBtn=$('.p27_Xx_Items');
xBtn.click(function(){
zidong();
ne=$(this).index();
//获取 图片路径
var dizhi=$(this).find('img').attr('src');
//获取宽度参数 15是 margin-left + border 的值
var kuai=$(this).width()+10,
zong=xBtn.length*kuai - $('.p27_Xx_Container').width();
//修改小图片按钮样式
xBtn.removeClass('p27_Xx_Act');
$(this).addClass('p27_Xx_Act');
var num=parseInt(($('.p27_Xx_Container').width()/kuai));
//获取移动距离
lef=( ne-num/2 )*kuai;
//最左 最右判断
if( lef<0 )lef=0;
//执行滚动
$('.p27_Xx_Content').stop(true).animate({ left:-lef });
//修改大图路径
$('.p27_Xx_Image img').attr('src',dizhi);
daxiao();
//修改当前序列号信息
$('.p27_Xx_Title span').html( '<i>'+(ne+1)+'</i>/'+btn.length );
});
//计算大图位置
function daxiao(){
var ww=$(window).width(),
wh=$('.p27_Xx').height(),
xx=$('.p27_Xx_Shop');
var are=$('.p27_Xx_Image'),
img=$('.p27_Xx_Image img');
var he=wh-xx.height(),
jj=160; //上下最小间距的和
//还原 图片的默认尺寸,并隐藏
img.css({ opacity:0,width:'auto',height:'auto' });
//如果 图片的默认高度超出 窗口+间隙 的高度,则缩小高度
if( are.height() > wh-jj )img.height( wh-jj );
//获取图片 距离窗口上边的 间隙
var tp=(wh-are.height())/2;
//修改大图位置
$('.p27_Xx_Image').css({ top:tp,left:(ww-img.width())/2 });
//刷新大图描述 位置
$('.p27_Xx_Msg').css({ top:tp+are.height()+10 });
//刷新 大图框宽度 9是边框宽度
are.width( $('.p27_Xx_Image img').width()+9 );
//显示图片
img.css({ opacity:1 });
}
//详细界面 按钮挂接
$('.p27_Xx_ILeft').click(function(){
ne-=1;
if( ne<0 )ne=0;
xBtn.eq(ne).click();
});
$('.p27_Xx_IRight').click(function(){
ne+=1;
if( ne>=btn.length )ne=btn.length-1;
xBtn.eq(ne).click();
});
$('.p27_Xx_BtnLeft').click(function(){
$('.p27_Xx_ILeft').click();
});
$('.p27_Xx_BtnRight').click(function(){
$('.p27_Xx_IRight').click();
});
//激活显示出 按钮
$('.p27_Xx_Shop').hover(function(){
clearTimeout(m);
$(this).stop(true).animate({ bottom:0 });
},function(){
yincang();
});
//延时执行 隐藏 底部按钮区域
var m;
function yinca
|