Skip to content

Instantly share code, notes, and snippets.

@JarrydLong
Created July 24, 2017 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JarrydLong/a1be910b468c35eb25177d153c92f80e to your computer and use it in GitHub Desktop.
Save JarrydLong/a1be910b468c35eb25177d153c92f80e to your computer and use it in GitHub Desktop.
Hide the hovercard once the visitor has closed the chat window
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