热搜词
发表于 2017-10-8 10:24:53 | 显示全部楼层 |阅读模式
江湖家居V6.0至尊版装修效果图栏目中的图片集浏览页,底部带有缩略图的图片翻页效果,是通过 jQuery图片组展示插件----Galleria 来实现的,该组件放在 /static/script/galleria 文件夹下,通过 \themes\default\case\detail.html 模板调用 /static/script/galleria 文件夹内相关js和css文件。
调用Galleria 组件可以图片集中显示的大图自适应父级div容器的尺寸,但是该组件显示的大图并不完美,就是当图片原始尺寸比父级div容器小,会自动把图片放大显示,不能显示图片原始尺寸,造成放大显示的图片看起来粗糙,不美观。

有同样问题的装修网站:
土拨鼠装修网:http://www.tobosu.com/pic/tc/83872.html
信用家:http://www.xyj321.com/xiaoguotu/15.html   

展示效果较好的装修网:
土巴兔(js控制,兼容IE):http://xiaoguotu.to8to.com/c10038346.html  
一起装修网(js控制,兼容IE):http://www.17house.com/xiaoguotu/3717201.html   
爱福窝(js控制,兼容IE):http://meitu.fuwo.com/c1697273.html   
齐装网(js控制,不兼容IE):http://meitu.qizuang.com/p45964.html  

通过对比研究以上相关装修网站,在实现带有缩略图的图片翻页方案中,其中“一起装修网”中调用的js代码比较简洁而且兼容IE浏览器,于是借鉴“一起装修网”的js和css代码,实现带有缩略图的图片翻页效果完美显示,实现方法如下:

一、修改 \themes\default\case\detail.html 模板文件,修改后代码如下:

  1. <{include file="block/small-header.html"}>
  2. <style type="text/css">
  3. html{overflow-y: hidden;height: 100%;}
  4. </style>
  5. <link rel="stylesheet" href="%THEME%/static/script/customcrollbar/jquery.mCustomScrollbar.min.css" type="text/css" />
  6. <script type="text/javascript" src="%THEME%/static/js/xgt-xiangqing.js"></script>
  7. <script src="%THEME%/static/js/plug-in.js" type="text/javascript"  charset="utf-8"></script>
  8. <div class="content colorbg">
  9.   <!--面包屑导航开始-->
  10.   <div class="case_crumbs">
  11.     <ul class="lt">
  12.      <li><span class="ico_list breadna"></span>您的位置:<a href="index"><{$CONFIG.site.title}></a> ><a href="<{link ctl='case:items'}>">装修案例</a> ><a href="<{link ctl='case:detail' arg0=$detail.case_id}>"><{$detail.title}></a> </li>
  13.      </ul>
  14.     <ul class="wechatapp rt">
  15.         <li class="fenxiang"> <i class="fenxiang-bj"></i> <a href="javascript:;">分享</a>    </li>
  16.     <li class="weixin"> <i class="weixin-bj"></i> <a href="javascript:;">收藏到微信</a>    </li>
  17.     <li class="big_img"> <i class="big_img-bj"></i> <a target="_blank" href="http://static-xiaoguotu.17house.com/web/xiaoguotu/201703/03/201703031513343842.jpg">查看原图</a> </li>
  18.     <div class="coDe">
  19.       <div class="pic">[ 手机扫码 ]<img src="%THEME%/static/images/codeico.jpg" /></div>
  20.       <div class="show" id="QRimg" style="padding:5px;background-color:#fff;width:96px;height:80px;" val="<{$mobile_url}>"></div>
  21.     </div>
  22.     <label><a like="<{$detail.case_id}>"><font class="index_ico like_ico"></font><{$detail.likes}>人喜欢</a></label>
  23.     <label><font class="index_ico person_ico"></font><{$detail.views}>人浏览</label>
  24.     </li>
  25.       </ul>
  26.     </div>
  27.    
  28.   <!--面包屑导航结束-->
  29.   <div class="imgbox">
  30.     <!--带缩略图的图片组展示开始-->
  31.     <div class="imgbox-left lt">
  32.       <div class="imgbox-left-box">
  33.         <div class="img-sc"><i></i>收藏</div>
  34.         <div class="img-sch"><i></i>已收藏</div>
  35.       </div>
  36.       <div class="imgbox-left-prev  btn"></div>
  37.       <div class="imgbox-left-next btn_next btn"></div>
  38.       <div class="img-from cl">
  39.         <p class="img-from-price "><{$detail.title}></p>
  40.         <p class="img-from-biao bigPic_sheji"><a href="/price/">装修成这样要花多少钱</a></p>
  41.         <p class="img-from-biao bigPic_baojia"><a href="/tenders/">免费户型设计</a></p>
  42.       </div>
  43.       <div class="imgList">
  44.         <div class="imgList-left btn"></div>
  45.         <div class="imgList-right btn_next btn"></div>
  46.         <div class="imgList-box">
  47.           <ul class="imgList-ul  cl">
  48.             <{foreach $photos as $item}>
  49.             <li class="imgList-li" last="/case/detail-<{$detail.case_id}>.html"> <a href="javascript:;"> <img  class="lazy" src="<{$pager.img}>/<{$item.photo}>_small.jpg" data-src="<{$pager.img}>/<{$item.photo}>" alt="<{$detail.title}>" data-title="<{$detail.title}>" data-gid="<{$detail.case_id}>" data-src="<{$pager.img}>/<{$item.photo}>_small.jpg"/> </a> </li>
  50.             <{/foreach}>
  51.           </ul>
  52.         </div>
  53.         </ul>
  54.       </div>
  55.             <div class="cl"></div>
  56.     </div>

  57.     <!--带缩略图的图片组展示结束-->
  58.     <!--右侧栏开始-->
  59.     <div class="imgbox-right lt" id="case_right_content"> <{widget id="tenders/fast" title="免费装修设计" from="TSJ"}>
  60.       <div class="mb10 area">
  61.         <div class="pding">
  62.           <div class="sub_case_yuyue"> <{if $company}> <a href="<{$company.company_url}>" class="lt"><img src="<{$pager.img}>/<{$company.thumb}>" /></a>
  63.             <div class="lt">
  64.               <p><a href="<{$company.company_url}>" class="tit"><{$company.name}></a> </p>
  65.               <a href="<{link ctl='gs:yuyue' arg0=$company.company_id http='ajax'}>" mini-load="免费预约" class="btn  btn_main_sm">免费预约</a> </div>
  66.             <{elseif $designer}> <a href="<{link ctl='blog' arg0=$designer.uid}>" class="lt"><img src="<{$pager.img}>/<{$designer.face_80}>" /></a>
  67.             <div class="lt">
  68.               <p><a href="<{link ctl='blog' arg0=$designer.designer_id}>" class="tit"><{$designer.name}></a> </p>
  69.               <a href="<{link ctl='designer:yuyue' arg0=$designer.uid http='ajax'}>" mini-load="免费预约" class="btn  btn_main_sm">免费预约</a> </div>
  70.             <{elseif $gz}> <a href="<{link ctl='gz:detail' arg0=$gz.uid}>" class="lt"><img src="<{$pager.img}>/<{$gz.face_80}>" /></a>
  71.             <div class="lt">
  72.               <p><a href="<{link ctl='gz:detail' arg0=$gz.uid}>" class="tit"><{$gz.name}></a> </p>
  73.               <a href="<{link ctl='gz:yuyue' arg0=$gz.uid http='ajax'}>" mini-load="免费预约"  class="btn  btn_main_sm">免费预约</a> </div>
  74.             <{/if}>
  75.             <div class="cl"></div>
  76.           </div>
  77.         </div>
  78.         <div class="pding case_linian colorbg">
  79.           <p>设计理念:<{$detail.intro}></p>
  80.         </div>
  81.         <div class="pding"><{widget id="attr/attr" from='zx:case' value=$detail.attrvalues tpl='show.html'}></div>
  82.       </div>
  83.       <div class="mb20 pding area">
  84.         <h3>相关案例</h3>
  85.         <div class="sub_case_rtpic"> <{calldata mdl="case/case" order="views:DESC" city_id=$request.city_id limit=9}><a href="<{link ctl='case-detail' arg0=$item.case_id}>"><img src="<{$pager.img}>/<{$item.photo}>" /></a> <{/calldata}> </div>
  86.       </div>
  87.       <{if $CONFIG.comment.case_type == 'sns'}>
  88.       <{$CONFIG.comment.snscomment}>
  89.       <{elseif $CONFIG.comment.case_type == 'comment'}>
  90.       <div class="mb20 pding area">
  91.         <h3>评论(共<font class="fontcl2"><{$pager.count|default:'0'}></font>条)</h3>
  92.         <form class="pinglun" id='comment_form'>
  93.           <div>
  94.             <textarea class="text" name="content" placeholder="随便说点什么..."></textarea>
  95.             <br />
  96.             <{if $comment_yz}>
  97.             <p>验证码
  98.               <input class="text short" type="text" name="verifycode" placeholder="请输入验证码"/>
  99.             </p>
  100.             <p><img verify="#comment-verify" src="/index.php?magic-verify&_=<{$pager.dateline}>" id="comment-verify"/><a verify="#comment-verify">点击刷新验证码</a> </p>
  101.             <{/if}>
  102.             <input type="submit" mini-submit='#comment_form' action="<{link ctl='case:comment' arg0=$detail.case_id}>" name="fbpl" value="发表评论" class="text btn pinglun_btn" />
  103.           </div>
  104.           <div class="cl"></div>
  105.         </form>
  106.         <div class="new_pinglun">
  107.           <p class="tit">最新评论</p>
  108.           <ul>
  109.             <{foreach $items as $item}>
  110.             <li> <img src="<{$pager.img}>/<{$user_list[$item.uid].face_32}>" class="lt" /><{$user_list[$item.uid].uname}>
  111.               <div class="rt">
  112.                 <p class="graycl"><{$item.dateline|format}></p>
  113.                 <p><{if $item.audit == 0}>
  114.                 <p class="tips"><span class="lock">该评论正在审核中</span></p>
  115.                 <{else}><{$item.content}><{/if}>
  116.                 </p>
  117.               </div>
  118.             </li>
  119.             <{/foreach}>
  120.             <{if $pager.pagebar}>
  121.             <div class="page hoverno"><{$pager.pagebar}></div>
  122.             <{/if}>
  123.           </ul>
  124.         </div>
  125.       </div>
  126.       <{/if}> </div>
  127.     <!--右侧栏结束-->
  128.   </div>
  129.   <div class="cl"></div>
  130. </div>
复制代码



全部评论3
灰儿 发表于 2017-10-8 20:06:51 | 显示全部楼层
二、新建 /static/js/xgt-xiangqing.js文件,代码如下:

  1. "use strict";

  2. $(function(){

  3.         var content_Height = $(window).height()-41;
  4.         $(".content").css({
  5.                 "height":content_Height
  6.                 });
  7.        
  8.         var selfAdaption  = function(){
  9.                 /* 自适应 */
  10.         var mHeight = $(window).height()-230;
  11.         var iWidth = $(window).width()-$(".imgbox-right").width()-90;
  12.         var mg = $(window).width()*0.4;       
  13.         var imgheight =parseInt($(".imgbox-left-box").find("img").attr("height"));//图片的高
  14.         var imgwidth = parseInt($(".imgbox-left-box").find("img").attr("width"));//图片的宽
  15.         var imgBL = imgwidth/imgheight;
  16.                 if(iWidth<=416){
  17.                         iWidth=416;
  18.                 };
  19.                 if(mHeight<416){
  20.                         mHeight = 416+110
  21.                 };
  22.                 $(".imgbox-left").css({
  23.                         "width":iWidth,
  24.                         "height":mHeight
  25.                 });
  26.                  if($(window).width()<=1370){
  27.                                 mg=mg-200
  28.                                 }else{
  29.                                 mg = mg+100
  30.                                 }
  31.                 if(imgheight>=mHeight-110){//图片高度大于盒子高-110    且   盒子高*0.8/imgBL大于盒子高-110
  32.                        
  33.                         if(iWidth*0.8/imgBL >= mHeight-110){
  34.                                 $(".imgbox-left-box").find("img").css({
  35.                                         "width":(mHeight-110)*imgBL,
  36.                                         "height":mHeight-110,
  37.                                 });
  38.                
  39.                                 $(".imgbox-left-box").css({
  40.                                         "width":(mHeight-110)*imgBL,
  41.                                         "height":mHeight-110,
  42.                                         "top":"50%",
  43.                                         "left":"50%",
  44.                                         "margin-left":-(mHeight-110)*imgBL/2,
  45.                                         "margin-top":-(mHeight-110)/2-30
  46.                                 });
  47.                         //        console.log("图片高度大于盒子高-110    且   盒子高*0.8/imgBL大于盒子高-110")
  48.                         }else{
  49.                                 $(".imgbox-left-box").find("img").css({
  50.                                         "width":iWidth*0.8,
  51.                                         "height":iWidth*0.8/imgBL,
  52.                                 });
  53.                
  54.                                 $(".imgbox-left-box").css({
  55.                                         "width":iWidth*0.8,
  56.                                        
  57.                                         "height":iWidth*0.8/imgBL,
  58.                                         "top":"50%",
  59.                                         "left":"50%",
  60.                                         "margin-left":-iWidth*0.8/2,
  61.                                         "margin-top":-iWidth*0.8/imgBL/2-30
  62.                                 });
  63.                                 //console.log("图片-110")
  64.                         };       
  65.                                
  66.                 }else if( iWidth*0.8/imgBL < mHeight-110 ){
  67.                         $(".imgbox-left-box").find("img").css({
  68.                                 "width":iWidth*0.8,
  69.                                 "height":iWidth*0.8/imgBL,
  70.                         });
  71.        
  72.                         $(".imgbox-left-box").css({
  73.                                 "width":iWidth*0.8,
  74.                                 "height":iWidth*0.8/imgBL,
  75.                                 "top":"50%",
  76.                                         "left":"50%",
  77.                                 "margin-left":-iWidth*0.8/2,
  78.                                 "margin-top":-iWidth*0.8/imgBL/2-30
  79.                         });
  80.                         //console.log("图片-220")
  81.         }else{
  82.                         $(".imgbox-left-box").find("img").css({
  83.                                 "width":imgwidth,
  84.                                 "height":imgheight,
  85.                         });
  86.        
  87.                         $(".imgbox-left-box").css({
  88.                                 "width":imgwidth,
  89.                                 "height":imgheight,
  90.                                 "top":"50%",
  91.                                         "left":"50%",
  92.                                 "margin-left":-imgwidth/2,
  93.                                 "margin-top":-imgheight/2-30
  94.                         });
  95.                         //console.log("图片-330")
  96.                 };

  97.                 $(".imgbox-right").height(mHeight+109);
  98.                 if($(window).width()<=1200){ //悬浮表单按钮
  99.                     $(".img-from").addClass("img-fromSM");
  100.                     $(".img-from").find(".img-from-price").css({
  101.                             "margin-left":25
  102.                     });
  103.                     $(".img-from").find(".img-from-biao").css({
  104.                             "margin-top":10
  105.                     });
  106.             }else{
  107.                     $(".img-from").removeClass("img-fromSM");
  108.                     $(".img-from").find(".img-from-biao").css({
  109.                             "margin-top":0
  110.                     });
  111.                     $(".img-from").find(".img-from-price").css({
  112.                             "margin-left":0
  113.                     });
  114.             };
  115.             $(window).resize(function(){
  116.                         //盒子自适应
  117.                         var mLeft = $(window).width()-$(".imgbox-right").width()-90;//图片盒子的宽
  118.                         var mHeight = $(window).height()-230;                       //图片盒子的高
  119.                         var mg = $(window).width()*0.4;                             //分享 微信 放大图片的 定位
  120.                         var ml = 0;
  121.                         if(mLeft<=416){
  122.                                 mLeft = 416;
  123.                                 ml = 0;
  124.                         }else{
  125.                                 ml = 30;
  126.                         }
  127.                         if(mHeight<=416){
  128.                                 mHeight = 416;
  129.                         };
  130.                         $(".imgbox-left").css({
  131.                                 "width":mLeft,
  132.                                 "height":mHeight,
  133.                                 "margin-left":ml
  134.                         });
  135.        
  136.                         if($(window).width()<=1370){
  137.                                 mg=mg-200
  138.                                 }else{
  139.                                 mg = mg+100
  140.                                 }       

  141.                                
  142.                        
  143.                         //分享 微信 查看原图
  144.                         if($(window).width()<=980){
  145.                                 $(".path").css({
  146.                                         "height":"auto"
  147.                                 });
  148.                         }else{
  149.                                 $(".path").css({
  150.                                         "height":"40px"
  151.                                 });
  152.                         };
  153.                     $(".imgbox-right").height(mHeight+109);
  154.                     if($(window).width()<=1200){
  155.                             $(".img-from").addClass("img-fromSM");
  156.                             $(".img-from").find("p").css({
  157.                                     "margin-top":10
  158.                             });
  159.                     }else{
  160.                             $(".img-from").removeClass("img-fromSM");
  161.                             $(".img-from").find("p").css({
  162.                                     "margin-top":0
  163.                             });
  164.                     };
  165.                  
  166.                    var bww = $(".imgbox-left").width()+ml+34+258;
  167.                          $("#ascrail2000").css({
  168.                                 "left":bww
  169.                                 });
  170.                
  171.                 });
  172.         };       
  173.         //selfAdaption()//初始化
  174.        
  175.         var displayImg = {
  176.                 init:function(){
  177.                         this.$parents = $('.imgbox'); //幻灯片外层容器
  178.                         this.$imgBox = $(".imgbox-left-box");//容器盒子
  179.                         this.$bigImg = $(".img-big");//大图
  180.                         this.$imgSc = $(".img-sc");//收藏
  181.             this.$bigPrevBtn = $('.imgbox-left-prev'); //大图向左按钮
  182.             this.$bigNextBtn = $('.imgbox-left-next'); //大图向右按钮
  183.             this.$smallImgBox = $('.imgList'); //所有小图容器,包含左右按钮
  184.             this.$scrollSmallBox = $('.imgList-box ul'); //小图滚动容器
  185.             this.$smallPrevBtn = $('.imgList-left'); //小图向左按钮
  186.             this.$smallNextBtn = $('.imgList-right'); //小图向右按钮
  187.             this.$smallImgLi = $('.imgList-box li'); //小图列表li
  188.             this.$smallImg = $('.imgList-li img'); //所有小图
  189.             this.listWidth = 90*this.$smallImgLi.length; //滚动容器宽度
  190.             this.smallImgIndex = 0; //默认展示第一张小图
  191.             
  192.             this.$scrollSmallBox.width(this.listWidth).css({'margin-left':0});
  193.             this.$smallImgLight = this.$smallImgLi.eq(this.smallImgIndex).addClass('active');

  194.             this.createBigImg(this.smallImgIndex); //显示大图
  195.             this.imgClick();
  196.             this.btnDisplay();
  197.             this.tabLabel(this,0);
  198.                 },
  199.                 /**
  200.              * 鼠标移入显示分类,鼠标移出隐藏分类
  201.              */
  202.             displayClassify : function(){
  203.                 var timer = null,
  204.                     $classify_icon = $('.path  .classify_icon'),
  205.                     $classify = $('.path .classify');
  206.                 $('.path .classify_icon,.path .classify').hover(function(){
  207.                     clearTimeout(timer);
  208.                     $classify_icon.addClass('active');
  209.                     $classify.show();
  210.                 },function(){
  211.                     $classify_icon.removeClass('active');
  212.                     timer = setTimeout(function(){
  213.                         $classify.hide();
  214.                     },100)
  215.                 });
  216.             },
  217.                 BigImgUrl : function(index){ //获取小图data-src里的链接
  218.                   return        this.$smallImgLi.eq(index).find(".lazy").attr("data-src");
  219.                 },
  220.                 /**
  221.         * 计算大图的大小显示
  222.         */
  223.         bigImgSize: function (imgW, imgH, divW, divH) {
  224.             var scale = imgW / imgH,
  225.                 scale2 = divW / divH,
  226.                 w,
  227.                 h;
  228.             scale > scale2 ? ( w = divW, h = divW / scale ) : ( w = scale * divH, h = divH );
  229.             return {
  230.                 w: w > imgW ? imgW : w,
  231.                 h: h > imgH ? imgH : h
  232.             }
  233.         },
  234.                 /**
  235.         * 创建大图
  236.         * @param index 创建大图需要的索引
  237.         */
  238.        createBigImg:function(index){
  239.                             var _this = this, //保存this
  240.                 $smallImg = this.$smallImg.eq(index),
  241.                 imgSrc = $smallImg.attr('data-src'),
  242.                 bigImgAlt = $smallImg.attr('data-title'),
  243.                 bigImgGid = $smallImg.attr('data-gid'),
  244.                 imgHtml = '<img data-gid="'+bigImgGid+'" title="'+bigImgAlt+'" src="'+imgSrc+'" id="bigImg" alt="'+bigImgAlt+'">',
  245.                 weixinQrSrc = 'http://weixin.17house.com/index.php?g=Home&m=Api&a=creatQr&restype=img&content=恭喜您收藏了'+bigImgAlt+',%3Ca+href%3D%27http%3A%2F%2Fm.17house.com%2Fxiaoguotu%2F'+bigImgGid+'.html%27%3E点击查看%3C%2Fa%3E';

  246.             // 微信二维码加载
  247.             $('.weixin-img').attr('src', weixinQrSrc);
  248.            

  249.                 // 大图加载完获取实际宽高
  250.             var newImg = new Image();
  251.             newImg.setAttribute("id","bigImg");
  252.             newImg.onload = function(){
  253.                 var imgWidth = this.width, //图片实际宽度
  254.                     imgHeight = this.height;  //图片实际高度
  255.                 var bigImgSize = _this.bigImgSize(imgWidth, imgHeight, 825, 510); //计算大图比例
  256.                 _this.$bigImg.remove();
  257.                 _this.$imgBox.prepend(imgHtml);
  258.                 _this.$bigImg = $('#bigImg');                      
  259.                 //设置大图宽高
  260.                 _this.$bigImg.css({
  261.                     "width": bigImgSize.w,
  262.                     "height":bigImgSize.h,
  263.                     "opacity":1
  264.                 }).attr({
  265.                     'src' : imgSrc,
  266.                     'title' : bigImgAlt,
  267.                     'data-gid' : bigImgGid,
  268.                     "height":imgHeight,
  269.                     "width":imgWidth
  270.                 });
  271.                       //判断次图片是否收藏
  272.                          if($(".siteNavBgRS").css("display")=="block"){
  273.                                 var uid = CommonCookie.getCookie("user");
  274.                                 var imgid = bigImgGid;
  275.                                 var urlP = "http://www.17house.com/xiaoguotu/iscollect/"+uid+"/"+imgid+"/";
  276.                                 $.getJSON(urlP, function(data) {
  277.                                                 if(data.status == 1){
  278.                                                         $(".img-sc").hide();
  279.                                                         $(".img-sch").show();
  280.                                                 }else{
  281.                                                         $(".img-sc").show();
  282.                                                         $(".img-sch").hide();
  283.                                                 }
  284.                                          });
  285.                                 }else{

  286.                         $(".img-sc").show();
  287.                                                         $(".img-sch").hide();
  288.                                 };
  289.                 //设置大图容器宽高
  290.                 _this.$imgBox.css({
  291.                     "width": bigImgSize.w,
  292.                     "height":bigImgSize.h
  293.                 });
  294.                                 selfAdaption() //大图替换后格式化
  295.                 //查看大图
  296.                 $('.big_img a').attr({'href':imgSrc});
  297.             }               
  298.                        
  299.                 newImg.src = imgSrc;


  300.             // 页面title添加
  301.             if( bigImgAlt ) {
  302.                 document.title = bigImgAlt+'-一起装修网装修效果图';
  303.             }

  304.             // 改变页面url
  305.             var thisurl = "http://"+window.location.host+"/case/detail-" + bigImgGid + ".html";
  306.             if (window.history.pushState) {
  307.                 window.history.pushState({ pageIndex: 1 }, bigImgAlt);//, thisurl
  308.                 return true;
  309.             }
  310.           },
  311.                imgClick : function(){
  312.                     var _this = this;
  313.                     //点击图片切换
  314.                     this.$smallImg.each(function(index,ele){
  315.                         var $target = $(ele);
  316.                         $target.bind('click',function(){
  317.                             _this.$smallImgLi.removeClass('active').eq(index).addClass('active');
  318.                             _this.createBigImg(index);
  319.                             _this.smallImgIndex = index;
  320.                            _this.tabLabel(_this,_this.smallImgIndex);
  321.                         });
  322.                     });
  323.        
  324.                     //点击左右按钮切换
  325.                     this.$parents.delegate('.btn','click',function(ev){
  326.                         var $target = $(this),
  327.                             marginLeft = parseInt(_this.$scrollSmallBox.css('margin-left'));
  328.                         if($target.hasClass('btn_next')){//向右
  329.                             _this.smallImgIndex++;
  330.                             if(_this.smallImgIndex == _this.$smallImgLi.length){
  331.                                         var        urlA = _this.$scrollSmallBox.find("li.imgList-li:last").attr("last");
  332.                                     window.location.href=urlA;
  333.                                                 };
  334.                             if(_this.smallImgIndex > 3){
  335.                                 marginLeft = (_this.smallImgIndex - 3) * 90;
  336.                                 if(!_this.$scrollSmallBox.is(':animated')){
  337.                                     _this.$scrollSmallBox.stop(false,true).animate({'marginLeft' : -marginLeft});
  338.                                 };
  339.                             };
  340.        
  341.                         }else{//向左
  342.                              _this.smallImgIndex--;
  343.                             if(_this.smallImgIndex < 0){
  344.                                 _this.smallImgIndex = 0;
  345.                             }
  346.                             if(_this.smallImgIndex >= 3){
  347.                                 marginLeft += 90;
  348.                                 if(!_this.$scrollSmallBox.is(':animated')){
  349.                                         if(parseInt(_this.$scrollSmallBox.css("margin-left"))>=0){
  350.                                                 marginLeft=0
  351.                                         }
  352.                                     _this.$scrollSmallBox.stop(false,true).animate({'marginLeft' : marginLeft});
  353.                                 }
  354.                             };
  355.                             if(_this.smallImgIndex < 3 && parseInt(_this.$scrollSmallBox.css("margin-left"))<0){
  356.                                 marginLeft = 0;
  357.                                 if(!_this.$scrollSmallBox.is(':animated')){
  358.                                         _this.$scrollSmallBox.stop(false,true).animate({'marginLeft' : marginLeft});
  359.                                 }
  360.                             };
  361.                             
  362.                         }
  363.        
  364.                         _this.$smallImgLi.removeClass('active').eq(_this.smallImgIndex).addClass('active');
  365.                         _this.createBigImg(_this.smallImgIndex);
  366.                         _this.tabLabel(_this,_this.smallImgIndex);       
  367.                         ev.stopPropagation();
  368.                     });
  369.                 },
  370.                 btnDisplay : function(){
  371.                     var _this = this;
  372.                     this.$parents.hover(function(){
  373.                         _this.$bigPrevBtn.show();
  374.                         _this.$bigNextBtn.show();
  375.                         $('.tp_design,.tp_collect').show();
  376.                     },function(){
  377.                         _this.$bigPrevBtn.hide();
  378.                         _this.$bigNextBtn.hide();
  379.                         $('.tp_design,.tp_collect').hide();
  380.                     })
  381.                 },
  382.                 //切换图片 标签价格 跟着变

  383.        
  384.             }

  385.            displayImg.init()//初始化
  386.     displayImg.displayClassify();

  387.         tuPopTk.sheji();//设计报名
  388.        

  389. })
复制代码

回复

使用道具 举报

灰儿 发表于 2017-10-13 21:47:24 | 显示全部楼层
三、在 /themes/default/static/css/append.css 样式表文件中,添加如下代码:

  1. /*装修案例样式修改  2015-03-30*/

  2. .content{
  3.         width: 100%;
  4. }

  5. .case_crumbs{
  6.         padding:6px 30px;
  7.         border-bottom:1px solid #ddd;
  8.     position: relative;
  9.     height: 40px;
  10.     min-width: 700px;
  11.     background: #fff;
  12. }
  13. .case_crumbs ul {
  14.     padding-left: 10px;
  15. }
  16. .case_crumbs li {
  17.     display: inline-block;
  18.     line-height: 40px;
  19.     position: relative;
  20.     padding: 0 20px;
  21. }
  22. .case_crumbs .wechatapp {
  23.     width: 600px;
  24.     margin-right: 300px;
  25.     position: relative;
  26. }

  27. .imgbox{ width: 100%; min-width: 700px;position: relative; z-index: 1; margin-top: 30px;}
  28. .imgbox-left{width: 70%; height:700px;   background: #fff; border: 1px solid #f0f0f0;margin-left: 30px;position: relative;}
  29. .imgbox-left .imgbox-left-box{position: absolute; width: 70%;height:600px;  max-width: 80%; margin-left: -40%;}

  30. .imgbox-left-box .img-sc,.imgbox-left-box .img-sch{ cursor: pointer;position: absolute;height: 40px; padding-left: 35px; padding-right: 10px; line-height: 40px; background: url(../images/yinxiang-chun.png) repeat; right: 20px; top: 20px; font-size: 16px; color: #fff; text-align: center; z-index: 1;}
  31. .imgbox-left-box .img-sch{display: none;}
  32. .imgbox-left-box .img-sc:hover,.imgbox-left-box .img-sch:hover{color:#00a151;}
  33. .imgbox-left-box .img-sc i,.imgbox-left-box .img-sch i{position: absolute; top: 7px; left: 7px; display: inline-block; width: 25px; height: 25px; background: url(../images/xgt_xbt.png) no-repeat center; background-position: 0 -546px;}
  34. .imgbox-left-box .img-sch i{background-position: 0 -546px;}

  35. .imgbox-left-prev,.imgbox-left-next{width: 55%; height: 80%; position: absolute; top: 0; }
  36. .imgbox-left-prev{left: 0;cursor: url(../images/left.ico),auto !important; opacity:0;filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0);}
  37. .imgbox-left-next{right:0; cursor: url(../images/right.ico),auto !important; opacity:0;filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0);}
  38. .imgbox-left .imgList{width:100%; height: 90px; padding-top: 14px; position: absolute; bottom: -94px;}
  39. .imgbox-left .imgList .imgList-left,.imgbox-left .imgList .imgList-right{position: absolute; top: 14px;height: 100%;width:28px; height: 80px; background: url(../images/xgt_xbt.png) no-repeat;  cursor: pointer;}
  40. .imgbox-left .imgList .imgList-right{background-position:-101px -385px; right: 0;}
  41. .imgbox-left .imgList .imgList-left{background-position:-101px -275px;left: 0;}
  42. .imgbox-left .imgList .imgList-box{ width: 94%; height: 80px; margin-left: 3%; overflow: hidden;}
  43. .imgbox-left .imgList .imgList-li{float: left; width: 76px; height: 76px; margin-left: 10px; border:2px solid transparent;}
  44. .imgbox-left .imgList .imgList-li.active{ border:2px solid #00a151;}
  45. .imgbox-left .imgList .imgList-li img{width: 100%; height: 100%;}

  46. .img-from{ position: absolute; bottom: 0;width: 810px; height: 60px; /*background: #fff;*/ left: 50%; margin-left: -405px; padding-top:20px ;}
  47. .img-from.img-fromSM{width:500px;height:96px;margin-left:-250px;padding:0; text-align: center;}
  48. .img-from .img-from-price{display: inline-block; font-size: 18px; font-weight: bold; }
  49. .img-from .img-from-price .price{font-size: 24px;}
  50. .img-from .img-from-price i{font-weight:100 ; color: #282828;}
  51. .img-from .img-from-biao{display: inline-block; width: 198px; height: 40px; line-height: 40px; border: 1px solid #00a151; color: #00a151; border-radius: 3px; text-align: center; cursor: pointer; margin-right: 20px;}
  52. .img-from .img-from-biao:hover{background: #00a151; color: #fff;}
  53. .img-from .img-from-baojia{}
  54. .img-from .img-from-sheji{}
  55. .sr-bdimgshare-list,.bdselect_share_head,.bdselect_share_content{display: none!important;}
  56. .relocation{display: none!important;}

  57. .imgbox-right {background: #fff; position: absolute;top: 0;right: 0;width: 280px;height:auto;overflow-x:hidden;overflow-y:auto;  z-index: 0;}

  58. .pic_container.full .pic_right_content {visibility:hidden;}
  59. .pic_container.full .img_content {margin-right: 0;}
  60. .pic_container.full .custom_scroll {display: none;}
  61. .img_content {padding:10px; background:#fff;font-size: 12px;min-height: 300px;margin-right: 265px;position: relative;z-index: 1;}


  62. .case_pic_top{ width:100%; background:none;}
  63. .galleria-thumbnails-container{ background:#505050; padding:7px 5px; height:auto;}
  64. .galleria-thumbnails .galleria-image{ width:60px; height:60px;}
  65. .notouch .galleria-thumb-nav-left:hover, .notouch .galleria-thumb-nav-right:hover{ background:#999;}
  66. .galleria-thumb-nav-left, .galleria-thumb-nav-right{top:15px; background-color:#f0f0f0; margin:0px 5px;}
复制代码


回复

使用道具 举报

灰儿 发表于 2017-10-13 21:47:59 | 显示全部楼层
一起装修网效果图内容页带缩略图轮播实现方法
http://www.admin365.cn/thread-41572-1-1.html
回复

使用道具 举报

回复
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|管理员之家 ( 苏ICP备2023053177号-2 )

GMT+8, 2024-6-17 02:10 , Processed in 0.176625 second(s), 21 queries .

Powered by Discuz! X3.5

Cpoyright © 2001-2024 Discuz! Team