Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2014
    Thanked 0 Times in 0 Posts

    Closing Popup after clicking outside Form

    Hi guys!

    I'm just trying to set up my mail chimp popup that what it closes automatically when you click outside the form. I have it basically working and it doesn't close when you click inside the form but it does lockup the submit button and all the form functionality. I think it may have something to do with the return false.

    This is the code I'm using to hide the pop-up when clicking out side and disregard the hide when clicking in form.

    if (show){
    $('#mc_embed_signup a.mc_embed_close').show();
    setTimeout( function(){ $('#mc_embed_signup').fadeIn();} , 2000);
    $('#mc_embed_signup a.mc_embed_close').click(function(){ mcEvilPopupClose();});

    //User Code
    $('#mc-embedded-subscribe-form').click(function(){ return false;});
    $('#mc_embed_signup').click(function(){ mcEvilPopupClose();});

    This is the function for hiding it.

    function mcEvilPopupClose(){
    var now = new Date();
    var expires_date = new Date( now.getTime() + 31536000000 );
    document.cookie = 'MCEvilPopupClosed=yes;expires=' + expires_date.toGMTString()+';path=/';

    It's all Javascript any help would be much appreciated!

  2. #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Halle (Saale), Germany
    Thanked 1,118 Times in 1,090 Posts
    I would suggest you check whether your mouse is inside or outside the form and if outside you close the popup. Something like this:

    PHP Code:
    var inside false;
    'body').click(function() {
    inside && $('#mc_embed_signup').is(':visible')) {

    mouseenter(function() {
    inside true;
    mouseleave(function() {
    inside false;


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts