Created
July 24, 2017 19:57
-
-
Save JarrydLong/a1be910b468c35eb25177d153c92f80e to your computer and use it in GitHub Desktop.
Hide the hovercard once the visitor has closed the chat window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).on('wplc_animation_done', function(){ | |
var should_hide = Cookies.get('wplc_prevent_popup'); | |
if( should_hide == '1' && typeof should_hide != 'undefined' ){ | |
jQuery("#wplc_hovercard").hide(); | |
} else { | |
jQuery("#wplc_hovercard").fadeIn(); | |
jQuery("#wp-live-chat-header").addClass('active'); | |
} | |
jQuery("#wp-live-chat-header").on("click", function(){ | |
if( jQuery(this).hasClass('active' ) ){ | |
var permanently_closed = Cookies.get( 'wplc_prevent_popup' ); | |
if( typeof permanently_closed == 'undefined' ){ | |
Cookies.set('wplc_prevent_popup', 1, { expires: 1, path: '/' }); | |
} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment