How to define fixed position on scroll down event for divi modules - kary4/divituts GitHub Wiki

Firstly you need to add an additional css class to the section/row/module that you want to catch for fixed position. For ex. add stick-module. Then add the following code to the Wp admin>Divi>Theme options>Integration>Add code to the

of your blog option:
<script>

jQuery( document ).ready(function() {

jQuery(window).scroll(function(){

  if (jQuery(this).scrollTop()>200) {

    jQuery('.stick-module').each(function(){
      
      let stWidth = jQuery(this).width();
    
      jQuery(this).addClass('fixed');
      
      jQuery('.stick-module.fixed').width(stWidth);
    
    });

  } else {
    
    jQuery('.stick-module').removeClass('fixed');  

  }

});

}); 

</script>

Next add the following code to the Custom CSS field in ePanel

.stick-module.fixed {
    position: fixed;
    top: 90px;
    z-index: 99999999;
 }

Now you can use stick-module class for any module that you want to be fixed position when you scroll down your pages.

⚠️ **GitHub.com Fallback** ⚠️