ShopWT官网-php多用户商城系统-在路上

标题: ShoWT图片放大镜效果 [打印本页]

作者: hahawfg    时间: 2015-8-15 11:23
标题: ShoWT图片放大镜效果
这个不算是个插件,也不能自动安装,需要手动修改一下
只需要修改shop/template/default/store/goods.php 即可
首先引用 jquery.imagezoom.min.js
然后模版中的
  1. <div id="ncs-goods-picture" class="ncs-goods-picture image_zoom"></div>
复制代码
修改为
  1. <div id="ncs-goods-picture" class="ncs-goods-picture image_zoom">
  2.         <div class="box">
  3. <div class="tb-booth tb-pic tb-s310"  id="thumbview">
  4. </div>
  5. <ul class="tb-thumb" id="thumblist">
  6. </ul>
  7. <script type='text/javascript'>
  8. var imglist;
  9. <?php if (!empty($output['goods_image'])) {?>
  10.                        imglist= [<?php echo implode(',', $output['goods_image']);?>];
  11.                         <?php }?>
  12.                                 for(var i in imglist){
  13.                                         if($("#thumbview").find("img").size()<=0){
  14.                                                 $("#thumbview").append('<a href="javascript:void(0);" target="_blank"></a>');
  15.                                         }
  16.                                         $("#thumblist").append('<li><div class="tb-pic tb-s40"><a href="javascript:void(0);"></a></div></li> ');
  17.                                 }
  18. $(".jqzoom").imagezoom();
  19.   $("#thumblist li a").click(function () {
  20.       $(this).parents("li").addClass("tb-selected").siblings().removeClass("tb-selected");
  21.     $(".jqzoom").attr('src',$(this).find("img").attr("mid"));
  22.     $(".jqzoom").attr('rel',$(this).find("img").attr("big"));
  23.   });
  24. </script>
  25. </div>
复制代码

然后模版再往下找到这段代码,删除
  1. jQuery(function($){
  2.         //产品图片
  3.         $.getScript('<?php echo BASE_STATCS_URL?>/js/ImageZoom.js', function(){
  4.                 var
  5.                 zoomController,
  6.                 zoomControllerUl,
  7.                 zoomControllerUlLeft = 0,
  8.                 shell = $('#ncs-goods-picture'),
  9.                 shellPanel = shell.parent(),
  10.                 heightNcsDetail = $('div[class="ncs-detail"]').height();
  11.                 heightOffset = 60,
  12.                 minGallerySize = [360, 360],
  13.                 imageZoom = new ImageZoom({
  14.                         shell: shell,
  15.                         basePath: '',
  16.                         levelASize: [60, 60],
  17.                         levelBSize: [320, 320],
  18.                         gallerySize: minGallerySize,
  19.                         onBeforeZoom: function(index, level){
  20.                                 if(!zoomController){
  21.                                         zoomController = shell.find('div.controller');
  22.                                 }
  23.                                 var
  24.                                 self = this,
  25.                                 duration = 320,
  26.                                 width = minGallerySize[0],
  27.                                 height = minGallerySize[1],
  28.                                 zoomFx = function(){
  29.                                         self.ops.gallerySize = [width, height];
  30.                                         self.galleryPanel.stop().animate({width:width, height:height}, duration);
  31.                                         shellPanel.stop().animate({height:height + heightOffset}, duration).css('overflow', 'visible');
  32.                                         zoomController.animate({width:width-22}, duration);
  33.                                         shell.stop().animate({width:width}, duration);
  34.                                 };
  35.                                 if(level !== this.level && this.level !== 0){
  36.                                         if(this.level === 1 && level > 1){
  37.                                                 height = Math.max(480, shellPanel.height());
  38.                                                 width = shellPanel.width();
  39.                                                 zoomFx();
  40.                                         }
  41.                                         else if(level === 1){
  42.                                                 zoomFx();
  43.                                                 shellPanel.stop().animate({height:heightNcsDetail}, duration);
  44.                                         }
  45.                                 }
  46.                         },
  47.                         onZoom: function(index, level, prevIndex){
  48.                                 shell.find('a.prev,a.next')[level<3 ? 'removeClass' : 'addClass']('hide');
  49.                                 shell.find('a.close').css('display', [level>1 ? 'block' : 'none']);
  50.                         },
  51.                         items: [
  52.                         <?php if (!empty($output['goods_image'])) {?>
  53.                         <?php echo implode(',', $output['goods_image']);?>
  54.                         <?php }?>
  55.                                         ]
  56.                 });
  57.                 shell.data('imageZoom', imageZoom);
  58.         });
  59. });
复制代码


作者: hahawfg    时间: 2015-8-15 11:25
帖子忘了上传js,js附上

作者: ii8680    时间: 2015-8-16 10:59
老大,这个我照着修改后版面错位,图片也不显示了。
最后的</script></div>后面需要再加一个</div>版面正常,但还是不显示图片。
JS文件也挂载了,第2段代码部分也删除了,还是不显示
作者: 瓢泼    时间: 2015-8-18 14:06
表示和楼上一个问题
作者: hahawfg    时间: 2015-8-22 23:23
送上我的商品详情页模版 可能是少发个什么 原谅
作者: jk8757    时间: 2015-8-23 11:25
给力啊

作者: jk8757    时间: 2015-8-23 11:49
愚钝  不知道JS传在什么目录下。。。。望老大能指明
作者: talentbrown    时间: 2015-8-26 17:19
支持老大,太给力了
作者: ii8680    时间: 2015-9-11 12:00
改过,替换过,还是版面错乱,图片是可以显示了,但放大镜没用了。你确定是只改这一个文件,然后放置JS文件就行?
作者: ii8680    时间: 2015-9-12 16:40
有谁成功的,截个图我们看看
作者: yiyue    时间: 2015-9-18 10:34
(, 下载次数: 3)