javascript - Why does animate opacity not work in chrome? -
javascript - Why does animate opacity not work in chrome? -
i have simple code highlighting specific list item:
var $highlights = $j("div.ab-highlights ul li a"); $highlights.hover( function () { $j(this).children().addclass('active'); $j(this).parent().animate({opacity: 1}, 200); $highlights.not(this).parent().animate({opacity: 0.2}, 200); }, function () { $j(this).children().removeclass('active'); } ); the big problem not work in chrome (in firefox 4 & ie9 works great)
the site http://www.alonbt.com
the html is
<div class="ab-highlights"> <ul> <li class="mansfred"><a href="http://alonbt.com/musical-biography/"><span>musical biography</span></a></li> <li class="museek"><a href="http://alonbt.com/music-visualization-project/"><span>music visulisation project</span></a></li> <li class="ripui-sini"><a href="http://alonbt.com/chinese-acupuncture/"><span>chinese medicine website</span></a></li> <li class="gay-guide"><a href="http://alonbt.com/the-gay-guide/"><span>the gay guide</span></a></li> <li class="philosophy"><a href="http://alonbt.com/perhaps-magazine/"><span>magazine design</span></a></li> <li class="taxi"><a href="http://alonbt.com/5-facts-about-the-israeli-taxi/"><span>5 facts taxis</span></a></li> </ul> </div> what problem?
and little question - there way boolean whether rolling on object (something - ishover()?)
i believe animation piece should done in css. have not seen issues in chrome doing via css , performance amazing. went through our portal , diagnosed several javascript performance issues solved moving things such , minor animation css.
<ul class="myclass"> <li>one item</li> <li>two item</li> <li>three item</li> <li>four item</li> </ul> .myclass li { -ms-filter:"progid:dximagetransform.microsoft.alpha(opacity=20)"; filter: alpha(opacity=20); opacity:.2; -webkit-transition:opacity 1s linear; -moz-transition:opacity 1s linear; -ms-transition:opacity 1s linear; -0-transition:opacity 1s linear; transition:opacity 1s linear; cursor:point; } .myclass li:hover { -ms-filter:"progid:dximagetransform.microsoft.alpha(opacity=100)"; filter: alpha(opacity=100); opacity:1; } please check jsfiddle see work...adjust timing meet needs (s or ms)
i created basic illustration of opacity on hover on over jsfiddle here link. if have questions please comment, think happy solution.
javascript jquery css hover
Comments
Post a Comment