0
我想要做的事情是用一行图片嵌入并用JavaScript缩放.prev
和.next
。缩放本身运行良好,但我无法让邻居玩球。我正在用javascript和缩小尺寸
的代码如下:
$(document).ready(function() {
$('.img-zoom').hover(function() {
$(this).addClass("transition").parent().prev().addClass("side");
$(this).addClass("transition").parent().next().addClass("side");
},
function() {
$(this).removeClass("transition").parent().prev().removeClass("side");
$(this).removeClass("transition").parent().next().removeClass("side");
});
});
它的工作原理,当我剥CSS下来,那一定是很简单的东西。这里是CSS:
@charset "UTF-8";
/* CSS Document */
* {
padding: 0;
margin: 0;
}
body {
text-align: center;
}
li {
display: inline;
list-style-type: none;
}
ul {
text-align: center;
white-space: nowrap;
}
.main_wrapper {
width: 98%;
}
/* Dock */
.dock {
margin: auto;
list-style-type: none;
bottom: 0;
position: fixed;
left: 20%;
right: 20%;
width: 60%;
border-radius: 5px 5px 0 0;
padding-top: 0.5%;
padding-bottom: 1.0%;
background-color: rgba(171,171,171,0.2);
border-top-width: thin;
border-right-width: thin;
border-bottom-width: thin;
border-left-width: thin;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: none;
border-left-style: solid;
border-top-color: rgba(213,213,213,1);
border-right-color: rgba(213,213,213,1);
border-bottom-color: rgba(213,213,213,1);
border-left-color: rgba(213,213,213,1);
}
.dock li img {
margin-left: 0.4%;
margin-right: 0.4%;
box-sizing: border-box;
cursor: pointer;
background-size: cover !important;
background-position: center center !important;
background-repeat: no-repeat !important;
width: 8%;
-webkit-box-reflect: below 1%
-webkit-gradient(linear,
left top,
left bottom,
from(transparent),
color-stop(0.7, transparent),
to(rgba(255,255,255,.5)));
-webkit-transition: all 0.5s;
-webkit-transform-origin: 50% 100%;
}
/* Java Stuff */
.img-zoom {
-webkit-transition: all .2s ease-in-out;
-moz-transition: all .2s ease-in-out;
-ms-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
}
.transition {
-webkit-transform: scale(1.8);
-moz-transform: scale(1.8);
-o-transform: scale(1.8);
transform: scale(1.8);
}
.side {
-webkit-transform: scale(1.5);
-moz-transform: scale(1.5);
-o-transform: scale(1.5);
transform: scale(1.5);
}
.dock li:hover img {
margin-right: 1%;
margin-left: 2%;
}
.dock li:hover + li img,
.dock li.next img {
margin-right: 1%;
margin-left: 2%;
}
那是什么我做...它应该是在一个除法?它是一个菜单...?感谢您的帮助 –
没有问题,我刚刚得到您的HTML让我们重新写入剪切。 – Matt