javascript - Animate.css on scroll bug chrome/firefox -
i use animate.css implant animations on element when scrolling. elements have class .fadeinright
, hidden
. when appear on scroll, add class visible refer
{visibility:visible;}.
i see fade animation on safari, on chrome firefox element appear, without fading, ideas?
{edit} yep here element html
<section class="informations tadam fadeinleft"> text </section>
my js
$(window).scroll(function() { $('.tadam').each(function(){ var imagepos = $(this).offset().top; var topofwindow = $(window).scrolltop(); if (imagepos < topofwindow+(window.innerheight * 0.9)) { $(this).addclass("animated visible"); } }); });
and css these 2 class
.tadam{visibility:hidden;} .visible{visibility: visible;}
thanks help
this because make transition "hidden" "visible", property not animatable.
if element visibility
visible (or default) , use transition opacity:0
opacity:1
work.
so css should this:
.tadam{opacity: 0;} .visible{opacity: 1;}
if absolutely need use visibility should set timeout between visible class , animate class this:
var $this = $(this).addclass("visible"); settimeout(function(){ $this.addclass("animated"); },10); // 10 should enough, if doesn't work, add little more
(better late never guess)
Comments
Post a Comment