How to define fixed position on scroll down event (using a plugin) - kary4/divituts GitHub Wiki

Here is the plugin: http://stickyjs.com/

  1. Download the jQuery plugin and copy in into divi, for ex.: divi/js/jquery.sticky.js
  2. Use this code:
<script src="http://localhost/wp/wp-content/themes/Divi/js/jquery.sticky.js"></script>
<script>
  jQuery(document).ready(function(){
    jQuery("#sticker").sticky({topSpacing:200});
  });
</script> 
  1. Here is the line that does the job in the code above:
jQuery("#sticker").sticky({topSpacing:0});

Now you can define fixed position to any element on your page with different CSS IDs. If you need apply the effect to more elements just repeat the line: jQuery("#sticker").sticky({topSpacing:0}); with small changes.

The first parameters looks for the element ID (#sticker) and the second one (topSpacing:0) defines top position.

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