Advertisement
arie_cristianD

add_function_x_button

Jun 21st, 2023
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. function add_close_button_to_ads() {
  2.     ?>
  3.     <script>
  4.         /* Add Close Button for  Mobile Sticky Ads */
  5.         (function ($) {
  6.             $(window).ready(function () {
  7.                 var container = $('.jnews_mobile_sticky_ads'),
  8.                 wrapper = container.find('.ads-wrapper');
  9.                 wrapper.html(wrapper.html() + '<span id="close">X</span>');
  10.                 wrapper.find('#close').css({ 'position': 'absolute', 'top': '0px', 'right': '0', 'font-size': '32px', 'cursor': 'pointer' });
  11.                 wrapper.find('#close').click(function (e) {
  12.                     e.preventDefault();
  13.                     $(this).parent().parent().remove();
  14.                 });
  15.             });
  16.         })(jQuery);
  17.     </script>
  18.     <?php
  19. }
  20. add_action( 'wp_footer', 'add_close_button_to_ads' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement