jquery多图层叠展示特效代码

版权:原创 更新时间:1年以上
[该文章底部包含文件资源,可根据自己情况,决定是否下载资源使用,时间>金钱,如有需要,立即查看资源]

以下是 jquery多图层叠展示特效代码 的示例演示效果:

当前平台(PC电脑)
  • 平台:

部分效果截图:

jquery多图层叠展示特效代码

HTML代码(index.html):

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery多图层叠展示效果</title>
    <link rel="stylesheet" type="text/css" media="screen" href="css/reset.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="css/960.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="css/main.css" />
    <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="js/demo.js"></script>
  </head>
  <body>
  <div class="container_12" id="wrapper">
      <div class="grid_8" id="content">
        <!-- relevant for the tutorial - start -->
        <div class="grid_6 prefix_1 suffix_1" id="gallery">
          <div id="pictures">
            <img src="images/picture1.png" alt="" />
            <img src="images/picture2.png" alt="" />
            <img src="images/picture3.png" alt="" />
            <img src="images/picture4.png" alt="" />
            <img src="images/picture5.png" alt="" />
          </div>
          
          <div class="grid_3 alpha" id="prev">
            <a href="#previous">&laquo; Previous Picture</a>
          </div>
          <div class="grid_3 omega" id="next">
            <a href="#next">Next Picture &raquo;</a>
          </div>
        </div>
        <!-- relevant for the tutorial - end --><br />
        <br />
        <div class="clear"></div> 
    </div>
  </div>
</body>
</html>





JS代码(demo.js):

$(document).ready(function(){
	//perform actions when DOM is ready var z = 0;
	//for setting the initial z-index's var inAnimation = false;
	//flag for testing if we are in a animation var imgLoaded = 0;
	//for checking if all images are loaded $('#pictures').append('<div id="loader"></div>');
	//append the loader div,it overlaps all pictures $('#pictures img').each(function(){
	//set the initial z-index's z++;
	//at the end we have the highest z-index value stored in the z variable $(this).css('z-index',z);
	//apply increased z-index to <img> $(new Image()).attr('src',$(this).attr('src')).load(function(){
	//create new image object and have a callback when it's loaded imgLoaded++;
	//one more image is loaded if(imgLoaded == z){
	//do we have all pictures loaded? $('#loader').fadeOut('slow');
	//if so fade out the loader div}
}
);
}
);
	function swapFirstLast(isFirst){
	if(inAnimation) return false;
	//if already swapping pictures just return else inAnimation = true;
	//set the flag that we process a image var processZindex,direction,newZindex,inDeCrease;
	//change for previous or next image if(isFirst){
	processZindex = z;
	direction = '-';
	newZindex = 1;
	inDeCrease = 1;
}
//set variables for "next" action else{
	processZindex = 1;
	direction = '';
	newZindex = z;
	inDeCrease = -1;
}
//set variables for "previous" action $('#pictures img').each(function(){
	//process each image if($(this).css('z-index') == processZindex){
	//if its the image we need to process $(this).animate({
	'top':direction + $(this).height() + 'px'}
,'slow',function(){
	//animate the img above/under the gallery (assuming all pictures are equal height) $(this).css('z-index',newZindex) //set new z-index .animate({
	'top':'0'}
,'slow',function(){
	//animate the image back to its original position inAnimation = false;
	//reset the flag}
);
}
);
}
else{
	//not the image we need to process,only in/de-crease z-index $(this).animate({
	'top':'0'}
,'slow',function(){
	//make sure to wait swapping the z-index when image is above/under the gallery $(this).css('z-index',parseInt($(this).css('z-index')) + inDeCrease);
	//in/de-crease the z-index by one}
);
}
}
);
	return false;
	//don't follow the clicked link}
$('#next a').click(function(){
	return swapFirstLast(true);
	//swap first image to last position}
);
	$('#prev a').click(function(){
	return swapFirstLast(false);
	//swap last image to first position}
);
}
);
	

CSS代码(960.css):

.grid_3,.grid_4,.grid_5,.grid_6,.grid_7,.grid_8,.grid_9,.grid_10,.grid_11,.grid_12,.grid_13,.grid_14,.grid_15,.grid_16{display:inline;float:left;margin-left:10px;margin-right:10px}
.container_12 .grid_3,.grid_4{width:220px}
.container_12 .grid_6,.container_16 .grid_8{width:460px}
.container_12 .grid_9,.container_16 .grid_12{width:700px}
.alpha{margin-left:0}
.omega{margin-right:0}
.container_12 .grid_1{width:60px}
附件:下载该文件资源,减少时间成本(增值服务)
留言
该资源可下载
File Source
.rar
1.39 MB
Html Js 图片切换触摸4
最新结算
股权转让协议意向书模板
类型: .docx 金额: CNY 2.23¥ 状态: 待结算 详细>
股权转让协议意向书模板
类型: .docx 金额: CNY 0.28¥ 状态: 待结算 详细>
CSS3图片向上3D翻转渐隐消失特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
CSS3图片向上3D翻转渐隐消失特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
.net c# 将金额转人名币大写金额
类型: .rar 金额: CNY 2.39¥ 状态: 待结算 详细>
.net c# 将金额转人名币大写金额
类型: .rar 金额: CNY 0.3¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 2.23¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 0.28¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 2.23¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 0.28¥ 状态: 待结算 详细>
我们力求给您提供有用的文章,再此基础上,会附加营收资源,不做任何广告,让平台可以更好发展 若您发现您的权利被侵害,或使用了您的版权,请发邮件联系 sunlifel@foxmail.com ggbig觉得 : 不提供源码的文章不是好文章
合作伙伴
联系我们
  • QQ:21499807
  • 邮箱:sunlifel@foxmail.com
  • QQ扫一扫加QQ
    QQ扫一扫
Copyright 2023-2024 ggbig.com·皖ICP备2023004211号-1
打赏文章