javascript - on mouse enter misbehaving in Chrome -
i have on-mouse-enter trigger code (javascript listen mouse enters , css transitions) , lately, it's been acting funny in chrome; tested on v 44.0.2403.157m without error in console. acting funny, mean fade in-out effect skipping.
var shown = true; var parent = document.queryselector('.parent'); var child = document.queryselector('.child'); parent.addeventlistener('mouseenter', function(){ child.style.opacity = shown ? 0 : 1; shown = !shown; });
* { margin: 0; padding: 0; } .parent { width: 100%; margin: 10px auto; position: relative; } .child { position: absolute; top: 0; width: 100%; height: 100%; display: block; overflow: hidden; transition: opacity 0.5s linear; } p { padding: 1em; }
<div class="parent"> <img src="http://www.fundraising123.org/files/u16/bigstock-test-word-on-white-keyboard-27134336.jpg" alt="" width="500px" height="auto" /> <div class="child"> <img src="http://maui.hawaii.edu/tlc/wp-content/uploads/sites/53/2013/11/testing.jpg" alt="" width="500px" height="auto" /> </div> </div>
the code should work have in this example. appreciate have code alternatives , thoughts. thanks
i did research , there multiple reports issue here or here.your code works expected me in both firefox(38.0.5) , edge(20.10240.16384.0).i assume problem caused chrome considering code written well.
Comments
Post a Comment