Advertisement
brooklyndesignstudio

Divi Sticky Footer JS Code

Jan 22nd, 2017
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!----    Add Code to Divi - Integration - Add Code to <head>    ---->
  2. <script text= "text/javascript">
  3. jQuery(function($){
  4. function stickyFooter(){
  5. var footer = $("#main-footer");
  6. var position = footer.position();
  7. var height = $(window).height();
  8. height = height - position.top;
  9. height = height - footer.outerHeight();
  10. if (height > 0) {
  11. footer.css({'margin-top' : height+'px'});
  12. }
  13. }
  14. stickyFooter();
  15. $(window).resize(function(){
  16. stickyFooter();
  17. });
  18. });
  19. </script>
  20.  
  21. <!----    OLD CODE - Add Code to Divi - Integrations - Add Code to Body    ---->
  22. <script>// <![CDATA[
  23. function stickyFoot(){
  24.     var th = jQuery('#top-header').height(); var hh = jQuery('#main-header').height(); var fh = jQuery('#main-footer').height(); var wh = jQuery(window).height(); var ch = wh - (th + hh + fh); jQuery('#main-content').css('min-height', ch);
  25. }
  26. stickyFoot();
  27. jQuery(window).on("resize",stickyFoot);
  28. // ]]></script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement