Last active
August 22, 2019 16:51
-
-
Save JackGJenkins/b8160e3f237c8d7ea836af83d1a6db09 to your computer and use it in GitHub Desktop.
Simple jQuery snippet to show the Intercom messenger launcher when your user scrolls to the bottom of the page, or clicks a button.
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
//SHOW THE LAUNCHER WHEN A USER SCROLLS TO THE BOTTOM OF YOUR PAGE | |
//You'll need to have 'hide_default_launcher: true' defined in your intercomSettings object when the page loads initially. | |
$(window).scroll(function() { | |
if($(window).scrollTop() + $(window).height() == $(document).height()) { | |
Intercom('update', {"hide_default_launcher": false}); | |
} | |
}); | |
//SHOW THE LAUNCHER AFTER A USER CLICKS A BUTTON | |
//You'll need to replace the `#example_ID` used here with the ID of your button, | |
//or replace the .on() event handler entirely, if showing the messenger launcher after a different event. | |
$('#example_ID').on('click', function() { | |
Intercom('update', {"hide_default_launcher": false}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
When I set hide_default_launcher to "true", I see following error in browser console:
There are no errors when I set it to "false". However, widget hides/shows as expected. The only issue is error presence in console.