hideToggle()
The hideToggle() function hides the toggle button that would normally allow users to show the FacePop player when clicked.
Description
When the FacePop player is hidden, a toggle button typically remains visible, allowing users to show the player again. The hideToggle() function removes this toggle button from the view, providing a cleaner interface when the player is not needed.
This function is useful when you want to completely hide all FacePop elements temporarily without destroying the player instance. For example, you might want to hide both the player and its toggle button during certain interactions on your website.
Syntax
Answerly.FacePop.hideToggle();
Parameters
This function does not accept any parameters.
Return Value
This function does not return any value.
Example
Here's an example of how to use the hideToggle() function:
// Wait for the FacePop SDK to be loaded
window.addEventListener('FacePop:Loaded', function() {
// First, hide the player
Answerly.FacePop.hidePlayer();
// Then, hide the toggle button too
Answerly.FacePop.hideToggle();
// Later, when you want to show everything again
setTimeout(function() {
Answerly.FacePop.showToggle();
// Optional: also show the player
// Answerly.FacePop.showPlayer();
}, 5000); // Show toggle after 5 seconds
});
In this example, both the player and the toggle button are hidden when the page loads. After 5 seconds, the toggle button reappears, allowing users to show the player again when needed.
Related Functions
Notes
- When both the player and the toggle button are hidden, there will be no visible FacePop elements on the page, but the instance remains active and ready to be shown again.
- To completely remove FacePop from your page, use the destroy() method instead.
- This function does not affect the player's playback state. If the video was playing before hiding the toggle, it will continue playing in the background.