Source: Divi support.
- Give the item the class custom-scroll
- Add this to a code module. The 500 is the number of pixels from the top where it starts to fade out.
<style>
.custom-scroll {
opacity: 1;
transition:opacity 1s;
}
.custom-scroll.custom-hide {
opacity: 0;
}
</style>
<script>
jQuery(function($){
$(function() {
var header = $(".custom-scroll");
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 500) {
header.addClass("custom-hide");
} else {
header.removeClass("custom-hide");
}
});
});
});
</script>Code language: HTML, XML (xml)