Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #510364

    Hi. I have a video that loads in a modal. video in modal

    I’ve put in a notification shortcode on my page with a custom css “.comeback-message”. How can i trigger the notification to show whenever the user hits the close button of the video modal?

    Thanks so much in advance!

    #510388

    Hi nbfc!

    May we have temporary admin access to your website so we can see how exactly your notification is set up?

    It really sounds like you will need custom code in order to achieve the functionality you want. If that is the case you can enlist the aid of a freelancer here.

    Cheers!
    Dake

    #510390

    Hi Dake,

    Thanks for looking into this. Unfortunately my website is inside our dev environment hence won’t be accessible outside of my company’s network. However i think i’m almost there. I have a custom php function that i think just needs a little bit of tweaking in order to work. Essentially, my goal is to use the built-in magnific close “button” as the trigger to show the notification. The notification is created using the built-in enfold notification shortcode with a custom css “comeback-message”. below is the custom function:

    function add_custom_notification_box(){
    ?>
    <script>
    $("button.mfp-close").on('click',function(){
      $(“.comeback-message”).show();
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_notification_box');
    

    Thanks again for your help!

    #511139

    Hi!

    Thank you for the info. Maybe, this will work:

    function add_custom_notification_box(){
    ?>
    <script>
    	(function($) {
    		$(".mfp-close").on('click',function(){
    		  $(".comeback-message").show();
    		});
    	})(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_notification_box');

    Or use .toggle instead of .show.

    Best regards,
    Ismael

    #511633

    Hi Ismael,
    Thanks for the suggestion but unfortunately it’s still not working. The .comeback-message is not showing up after i close the magnific popup video. I tired using the .show and .toggle but still no luck.

    #511942

    Hi,

    Not sure if I have any further advice to give you, it’s very hard to give you accurate code/help if we can’t inspect the page. Is there any way you can upload something on a publicly accessible server somewhere?

    Best regards,
    Rikard

    #512359

    Hi Rikard,

    Thank you for your effort in helping me. I’ve decided to try a different approach hence won’t be needing this feature anymore. Maybe i’ll put this on the backburner for now and hopefully in the future someone here will be able to provide a solution.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘trigger a notification shortcode’ is closed to new replies.