Advertisement
phpface

Untitled

Apr 19th, 2024
501
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.97 KB | None | 0 0
  1. add_action( 'wp_footer', function() {
  2.  
  3.     ?>
  4.     <script type="text/javascript">
  5.         (function($) {
  6.             "use strict";
  7.  
  8.             function reLocateChatBox() {
  9.                 var comment = $('.single-video__comments.comments-fixed');
  10.  
  11.                 if (comment.length === 0) {
  12.                     return;
  13.                 }
  14.  
  15.                 var mainContent = $('.single-video__body__main .post-bottom');
  16.                 var screenWidth = $(window).width();
  17.  
  18.                 if (screenWidth <= 992) {
  19.                     // Move the comment section
  20.                     comment.appendTo(mainContent);
  21.                 } else {
  22.                     // Restore its location
  23.                     comment.appendTo($('.single-video__body').parent());
  24.                 }
  25.             }
  26.  
  27.             $(window).on('resize', reLocateChatBox);
  28.             $(document).ready(reLocateChatBox);
  29.  
  30.         })(jQuery);                
  31.     </script>
  32.     <?php
  33.  
  34. } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement