EduardET

Untitled

Jun 5th, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. ( function( $ ) {
  3.     $( document ).ready( function() {
  4.         function setTopMargin() {
  5.             if ( $( 'body' ).hasClass( 'page-id-5' ) ) {
  6.                 $height = 0;
  7.                 if ( $( '#wpadminbar' ).length ) {
  8.                     $height = $height + $( '#wpadminbar' ).height();
  9.                 }
  10.                 $padding = parseInt( $( '#page-container' ).css( 'padding-top' ).slice( 0, -2 ) );
  11.                 $height = $height + $( '#main-header' ).height() + $( '#main-content' ).height() - $( '#main-footer' ).height() + $padding;
  12.                 $( '#main-footer' ).css( 'margin-top', 'calc(100vh - ' + $height + 'px)' );
  13.             }
  14.         }
  15.         $( document ).ajaxSuccess( function() {
  16.             setTopMargin()
  17.         } );
  18.     } );
  19. } )( jQuery );
  20. </script>
Advertisement
Add Comment
Please, Sign In to add comment