Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-transform:scale causing 'blinking' when hovering

I am working on a catalog which uses css -transform attribute to scale each 'swatch' upon hovering.

Here's my problem: In some browsers and on certain sites, when you hover over the swatches, it causes the page to 'blink' as your roll over them. I cannot nail the problem down either, on one site it may be unique to Safari, on another it may only happen in Chrome, on another it's perfectly fine.

Wish I had more information, but maybe someone else has run into a similar problem.

Screenshot of catalog

.swatch {
  -webkit-box-shadow: #EFEFEF 2px 2px 0px;
  -webkit-transform: scale(1);
  -webkit-transition-duration: 0.2s;
  border: 1px solid white;
  position: relative;
  z-index: 1;

.swatch:hover {
  position:relative;
  z-index:10;
  transition-duration: 0.2s;
  transform:scale(1.8);
  -webkit-transition-duration: 0.2s;
  -webkit-transform:scale(1.8);
}

It also seems that the problem is remedied when removing any z-index attributes, but then the hover swatch is behind the other swatches; which does not work for this project.

Any thoughts are appreciated.

like image 425
Tony Beninate Avatar asked Jun 13 '11 15:06

Tony Beninate


People also ask

Why does my screen flash when I move my mouse?

Screen flickering is usually caused by outdated or corrupted display drivers. That's why updating or reinstalling the display driver is a solution that worked for many users.

How do I stop Javascript from flickering?

By default, the javascript / jQuery code you write is executed at Document ready. This means that the whole page is loaded before your changes are made. This can sometimes cause “flickering”. You can avoid this by changing the way Symplify executes javascript / jQuery.


4 Answers

I've had success adding

-webkit-backface-visibility: hidden;

to the offending element (.swatch in your case).

However, test it in older versions of Chrome and Safari to make sure it doesn't break anything else. In my experience, Safari 4 specifically isn't a big fan.

like image 100
alalonde Avatar answered Oct 01 '22 18:10

alalonde


I had the same problem at this morning. But I found an answer on the web few moments ago.

To prevent the Blink issue, put the follow property on your .swatch class (not on :hover):

-webkit-transform-style: preserve-3d;
like image 33
Fábio ZC Avatar answered Oct 01 '22 19:10

Fábio ZC


Try changing position:relative to position:absolute, and/or specify position attributes (top: x, left: y.

No idea if it will work, just throwing it out there.

like image 20
Chris Fletcher Avatar answered Oct 01 '22 19:10

Chris Fletcher


when mouse over the images(img:hover) in chrome works fine. you can use like this

.swatch img:hover

http://dinolatoga.com/2009/09/18/amazing-imag-hover-effects-with-webkit-and-css/

like image 45
user1352888 Avatar answered Oct 01 '22 20:10

user1352888