如何在尝试鼠标显示照片时停止闪烁背景

时间:2014-07-13 07:48:08

标签: html css image webkit

我正在制作一个包含两个图像的显示器(当您点亮时切换)但是当您这样做时,容器会填充背景颜色,周围区域也会填充

这是一些有问题的代码,其余的与第一个产品几乎相同。如果有人可以看看,将不胜感激。谢谢。  *图像只有1-1.6mb大

    <section class="wrap hidden-phone">        
           <div class="wrapper">

   <section class="featured">

<div class="container">
<div class="row">
<div class="span9">


               <ul class="product-list isotope">    
<li data-price="195">
<a href="/Pages/empty357.html" title="Classic Test">
<div class="image">
    <img class="primary" src="images/features/baretest.jpg" alt="That Bare Test doe" />
    <img class="secondary" src="images/features/bare%20t%20sc.jpg" alt="What you know bout this test doe" />
</div>
<div class="title">
    <div class="prices">
        <span class="price">$3HUNNAH</span>
    </div>
        <h3>Bare Test</h3>
    </div>
</a>
</li>


<li class="standard" data-price="228">
<a href="product/navy-linen-blazer.1" title="Navy Linen Blazer">

<div class="image">
<img class="primary" src="images/features/IMG_8652.jpg" alt="Navy Linen Blazer" />

<img class="secondary" src="images/features/IMG_8658.jpg" alt="Navy Linen Blazer" />

</div>

<div class="title">
<div class="prices"><span class="price">$228.00</span></div>
<h3>Navy Linen Blazer</h3>

</div>

</a>
</li>



 </div>


</div>  
</div>
</section>  


           </section>








    @media (max-width: 767px) {
  .container {
    padding: 0 10px;
    width: 540px;
  }
}
@media (max-width: 479px) {
  .container {
    padding: 0 10px;
    width: 300px;
  }
}





#load_more [class^="icon-"] {
  display: none;
}
#load_more .icon-spin {
  -webkit-animation-duration: 1s;
  -moz-animation-duration: 1s;
  -o-animation-duration: 1s;
  -ms-animation-duration: 1s;
  animation-duration: 1s;
}
#load_more.loading {
  -webkit-opacity: 0.5;
  -moz-opacity: 0.5;
  opacity: 0.5;
}
#load_more.loading [class^="icon-"] {
  display: inline-block;
}
.product-list {
  margin-left: -30px;
  overflow: visible !important;
  zoom: 1;
}
.product-list:before {
  content: '';
  display: block;
}
.product-list:after {
  content: '';
  display: table;
  clear: both;
}
@media (min-width: 768px) and (max-width: 979px) {
  .product-list {
    margin-left: -20px;
  }
}
@media (max-width: 767px) {
  .product-list {
    margin-left: -20px;
  }
}
@media (max-width: 480px) {
  .product-list {
    margin-left: 0;
  }
}
.product-list li {
  list-style: none;
  width: 270px;
  float: left;
  margin-left: 30px;
  margin-bottom: 30px;
}
@media (min-width: 980px) and (max-width: 1199px) {
  .product-list li {
    width: 213px;
  }
}
@media (min-width: 768px) and (max-width: 979px) {
  .product-list li {
    width: 166px;
    margin-left: 20px;
    margin-bottom: 20px;
  }
}
@media (max-width: 767px) {
  .product-list li {
    width: 210px;
    margin-left: 20px;
    margin-bottom: 20px;
  }
}
@media (max-width: 480px) {
  .product-list li {
    width: 300px;
    margin-left: 0;
    margin-bottom: 20px;
  }
}
.product-list li.featured {
  width: 570px;
    background-color:#2980b9
}
@media (min-width: 980px) and (max-width: 1199px) {
  .product-list li.tu
    tured {
    width: 456px;
  }
}
@media (min-width: 768px) and (max-width: 979px) {
  .product-list li.featured {
    width: 352px;
  }
}
@media (max-width: 767px) {
  .product-list li.featured {
    width: 40px;
  }
}
@media (max-width: 480px) {
  .product-list li.featured {
    width: 300px;
  }
}
.product-list a {
  position: relative;
  display: block;
  color: inherit;
  text-decoration: none;
  z-index: 20;
  -webkit-box-shadow: 0 1px 2px rgba(71, 73, 72, 0.19999999999999996);
  -moz-box-shadow: 0 1px 2px rgba(71, 73, 72, 0.19999999999999996);
  box-shadow: 0 1px 2px rgba(71, 73, 72, 0.19999999999999996);
  color: 0 1px 2px rgba(71, 73, 72, 0.19999999999999996);
}
.product-list a:hover {
  -webkit-box-shadow: 0 2px 3px rgba(71, 73, 72, 0.5);
  -moz-box-shadow: 0 2px 3px rgba(71, 73, 72, 0.5);
  box-shadow: 0 2px 3px rgba(71, 73, 72, 0.5);
  color: 0 2px 3px rgba(71, 73, 72, 0.5);
}
.product-list a:hover .image .secondary {
  -webkit-opacity: 1;
  -moz-opacity: 1;
  opacity: 1;
}
.product-list a:hover .title .rating {
  color: #3498db;
}
.product-list a .image {
  position: relative;
  background: url('../../img/preloader.gif') no-repeat center center;
}
.product-list a .image img {
  display: block;
  width: 100%;
}
.product-list a .image .secondary {
  position: absolute;
  top: 0;
  -webkit-transition: all 200ms ease-in-out;
  -moz-transition: all 200ms ease-in-out;
  -o-transition: all 200ms ease-in-out;
  -ms-transition: all 200ms ease-in-out;
  transition: all 200ms ease-in-out;
  -webkit-opacity: 0;
  -moz-opacity: 0;
  opacity: 0;
}
.product-list a .image .badge-sale {
  position: absolute;
  right: -10px;
  top: 40px;
  background-color: #2980b9;
  font-size: 12px;
  line-height: 12px;
  padding: 4px 8px;
  text-transform: uppercase;
  -webkit-border-radius: 2px 2px 0 2px;
  -webkit-background-clip: padding-box;
  -moz-border-radius: 2px 2px 0 2px;
  -moz-background-clip: padding;
  border-radius: 2px 2px 0 2px;
  background-clip: padding-box;
}
.product-list a .image .badge-sale:after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border: 10px solid;
  border-color: #0e6252 transparent transparent transparent;
  position: absolute;
  right: 0;
  bottom: -20px;
  z-index: -10;
}
.product-list a .title {
  padding: 20px;
  position: relative;
  background-color: #ffffff;
}
.product-list a .title:before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  background-color: #ffffff;
  position: absolute;
  left: 20px;
  top: -8px;
  -webkit-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
  -o-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  transform: rotate(45deg);
}
.product-list a .title .prices {
  text-align: right;
  float: right;
  margin-left: 20px;
  line-height: 20px;
  height: 20px;
}
.product-list a .title .prices .price {
  color: #7f8c8d;
  font-weight: 600;
  font-size: 14px;
}
.product-list a .title .prices .base {
  color: #c7c8c8;
  font-weight: 400;
  font-size: 11px;
}
.product-list a .title h3 {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
}
.product-list a .title .rating {
  margin-top: 10px;
  font-size: 12px;
  line-height: 15px;
  color: #c7c8c8;
}

2 个答案:

答案 0 :(得分:1)

您需要从CSS类box-shadow

中删除.product-list a:hover

<强> Fiddle


从此

.product-list a:hover {
    -webkit-box-shadow: 0 2px 3px rgba(71, 73, 72, 0.5);
    -moz-box-shadow: 0 2px 3px rgba(71, 73, 72, 0.5);
    box-shadow: 0 2px 3px rgba(71, 73, 72, 0.5);
    color: 0 2px 3px rgba(71, 73, 72, 0.5);
}

至此

.product-list a:hover {
    color: 0 2px 3px rgba(71, 73, 72, 0.5);
}

答案 1 :(得分:1)

之前的回答刚删除了框阴影。实际问题是每个容器的照片大小为1.6mb x 2,最大化缓存,因此需要重新加载。您可以使用jpegmini等程序压缩图像而不会降低质量。