ShopWT官网-php多用户商城系统-在路上
标题: ShoWT图片放大镜效果 [打印本页]
作者: hahawfg 时间: 2015-8-15 11:23
标题: ShoWT图片放大镜效果
这个不算是个插件,也不能自动安装,需要手动修改一下
只需要修改shop/template/default/store/goods.php 即可
首先引用 jquery.imagezoom.min.js
然后模版中的- <div id="ncs-goods-picture" class="ncs-goods-picture image_zoom"></div>
复制代码 修改为- <div id="ncs-goods-picture" class="ncs-goods-picture image_zoom">
- <div class="box">
- <div class="tb-booth tb-pic tb-s310" id="thumbview">
- </div>
- <ul class="tb-thumb" id="thumblist">
-
- </ul>
- <script type='text/javascript'>
- var imglist;
- <?php if (!empty($output['goods_image'])) {?>
- imglist= [<?php echo implode(',', $output['goods_image']);?>];
- <?php }?>
- for(var i in imglist){
- if($("#thumbview").find("img").size()<=0){
- $("#thumbview").append('<a href="javascript:void(0);" target="_blank"></a>');
- }
- $("#thumblist").append('<li><div class="tb-pic tb-s40"><a href="javascript:void(0);"></a></div></li> ');
- }
- $(".jqzoom").imagezoom();
- $("#thumblist li a").click(function () {
- $(this).parents("li").addClass("tb-selected").siblings().removeClass("tb-selected");
- $(".jqzoom").attr('src',$(this).find("img").attr("mid"));
- $(".jqzoom").attr('rel',$(this).find("img").attr("big"));
- });
- </script>
- </div>
复制代码
然后模版再往下找到这段代码,删除- jQuery(function($){
- //产品图片
- $.getScript('<?php echo BASE_STATCS_URL?>/js/ImageZoom.js', function(){
- var
- zoomController,
- zoomControllerUl,
- zoomControllerUlLeft = 0,
- shell = $('#ncs-goods-picture'),
- shellPanel = shell.parent(),
- heightNcsDetail = $('div[class="ncs-detail"]').height();
- heightOffset = 60,
- minGallerySize = [360, 360],
- imageZoom = new ImageZoom({
- shell: shell,
- basePath: '',
- levelASize: [60, 60],
- levelBSize: [320, 320],
- gallerySize: minGallerySize,
- onBeforeZoom: function(index, level){
- if(!zoomController){
- zoomController = shell.find('div.controller');
- }
- var
- self = this,
- duration = 320,
- width = minGallerySize[0],
- height = minGallerySize[1],
- zoomFx = function(){
- self.ops.gallerySize = [width, height];
- self.galleryPanel.stop().animate({width:width, height:height}, duration);
- shellPanel.stop().animate({height:height + heightOffset}, duration).css('overflow', 'visible');
- zoomController.animate({width:width-22}, duration);
- shell.stop().animate({width:width}, duration);
- };
- if(level !== this.level && this.level !== 0){
- if(this.level === 1 && level > 1){
- height = Math.max(480, shellPanel.height());
- width = shellPanel.width();
- zoomFx();
- }
- else if(level === 1){
- zoomFx();
- shellPanel.stop().animate({height:heightNcsDetail}, duration);
- }
- }
- },
- onZoom: function(index, level, prevIndex){
- shell.find('a.prev,a.next')[level<3 ? 'removeClass' : 'addClass']('hide');
- shell.find('a.close').css('display', [level>1 ? 'block' : 'none']);
- },
- items: [
- <?php if (!empty($output['goods_image'])) {?>
- <?php echo implode(',', $output['goods_image']);?>
- <?php }?>
- ]
- });
- shell.data('imageZoom', imageZoom);
- });
- });
复制代码
作者: 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)