Search code examples
htmlcssimagewebkit

How to stop flashing background when trying mouse over to reveal photo


I'm making a display that contains two images (switch when you hi light) but when you do so the containers fills with the background color and so does the surrounding area

This is a bit of the code in question the rest is pretty much the same as the first product. If someone could take a look it would be much appreciated. thanks. *the images are only 1-1.6mb large

    <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;
}

Solution

  • Previous answer just removed the box shadow. Actual issue is the size of the photos 1.6mb x 2 for each container maxes out cache so things need to reload. You can compress images with programs like jpegmini without loosing quality.