Hello again RueNel,
I did some debugging and the issue lied with the $(window).scrollTop() function, as well as the .position().top function that I was using previously. The $(window).scrollTop() was not recognized as function, and the .position().top would always return 0 instead of how far down an element was from the top of the page. Most likely outdated functions which caused browser compatibility issues.
Iv resolved the problem. Since I saw a ton of posts about the default X fade in effect firing too late (50% of the way into the view port) and asking how to change the trigger point. Heres the javascript I used. Feel free to edit the “1500” and “1000” values as you see fit.
$(document).ready(function() {
var inner = $(".down-arrow");
var elementPosTop = inner.offset().top;
var viewportHeight = $(window).height();
$(window).on('scroll', function() {
var scrollPos = window.scrollY;
var elementFromTop = elementPosTop - scrollPos;
if (elementFromTop > 1500 & elementFromTop < elementPosTop + viewportHeight) {
inner.removeClass("active");
}
if (elementFromTop < 1000 & elementFromTop < elementPosTop + viewportHeight) {
inner.addClass("active");
}
});
});
Here is the CSS animation for fading in an element.
//Down arrow animation css
.down-arrow {
visibility: hidden;
}
.down-arrow .active {
visibility:visible;
}
.down-arrow .active{
-webkit-animation-name: fadeInUp;
animation-name: fadeInUp;
-webkit-animation-duration: 1.0s;
animation-duration: 1.0s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation-delay: 0.5s;
animation-delay: 0.5s;
}
This code will fade in any element with the class .down-arrow near the bottom of the screen, and then hide the element when scrolled high out of view so it can be reset and fired again. Hopefully this can help someone else until the feature is added.
Oh and thanks for the reply as always, once I knew for sure the class commands worked with X it was much easier to figure out the issue.