我没有任何形状或形式的程序员,但我已经对我的BigCartel网站做了一些调整,预计将在未来几周内出来。我有一个服装系列,我想让消费者谁选择了一个产品,能够悬停在产品的形象,以查看其放大…(这里有一个来自耐克的例子,我的意思是:http://store.nike.com/us/en_us/pd/breathe-womens-short-sleeve-running-top/pid-11319700/pgid-11619220 )我想知道使用什么代码来制作消费者点击的图像/产品,并在悬停在某个区域时进行放大/放大……我看到一些代码上传,但由于我不是一个专业的程序员,我想知道在自定义代码中插入它的地方。我有一个CSS选项,HTML和我不知道我应该去“产品”或整体编码...(抱歉的菜鸟问题)……
我还想知道(如果我也可以把这个问题滑进去)如何在我的BigCartel站点上加快幻灯片放映的速度,甚至可能将其更改为溶解选项……再说一次,我应该在哪里插入代码..
我自己做了一些小改动,但同样,我不是程序员,还有一些额外的调整,我不想让我的网站变得如此“千篇一律”BigCartel的好朋友,给我这个链接来搜索和询问问题。非常感谢您的帮助!
发布于 2017-04-06 12:05:04
你有没有试过这个对我来说总是有效的https://codepen.io/ccrch/pen/yyaraz
JS
$('.tile')
// tile mouse actions
.on('mouseover', function(){
$(this).children('.photo').css({'transform': 'scale('+ $(this).attr('data-scale') +')'});
})
.on('mouseout', function(){
$(this).children('.photo').css({'transform': 'scale(1)'});
})
.on('mousemove', function(e){
$(this).children('.photo').css({'transform-origin': ((e.pageX - $(this).offset().left) / $(this).width()) * 100 + '% ' + ((e.pageY - $(this).offset().top) / $(this).height()) * 100 +'%'});
})
// tiles set up
.each(function(){
$(this)
// add a photo container
.append('<div class="photo"></div>')
// some text just to show zoom level on current item in this example
.append('<div class="txt"><div class="x">'+ $(this).attr('data-scale') +'x</div>ZOOM ON<br>HOVER</div>')
// set up a background image for each tile based on data-image attribute
.children('.photo').css({'background-image': 'url('+ $(this).attr('data-image') +')'});
})HTML
<div class="tiles">
<div class="tile" data-scale="1.1" data-image="http://ultraimg.com/images/0yS4A9e.jpg"></div>
<div class="tile" data-scale="1.6" data-image="http://ultraimg.com/images/hzQ2IGW.jpg"></div>
<div class="tile" data-scale="2.4" data-image="http://ultraimg.com/images/bNeWGWB.jpg"></div>
</div>CSS
@import url(http://fonts.googleapis.com/css?family=Roboto+Slab:700);
body {
background: #fff;
color: #000;
margin: 0;
}
.tiles {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.tile {
position: relative;
float: left;
width: 33.333%;
height: 100%;
overflow: hidden;
}
.photo {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
transition: transform .5s ease-out;
}
.txt {
position: absolute;
z-index: 2;
right: 0;
bottom: 10%;
left: 0;
font-family: 'Roboto Slab', serif;
font-size: 9px;
line-height: 12px;
text-align: center;
cursor: default;
}
.x {
font-size: 32px;
line-height: 32px;
}https://stackoverflow.com/questions/43244740
复制相似问题