← view more API documentation

api.box.onExpand

Whenever the chatbox is expanded, the given callback will be triggered.

Examples

You could make it so that when the visitor expands the chatbox, the rest of the page goes dim for a moment to focus attention on the box:

olark('api.box.onExpand', function() {
    // dim the rest of the page
    document.getElementById('content').className = 'dim';
    setTimeout(function(){
        // after 3 seconds, turn off dimming
        document.getElementById('content').className = '';
    }, 3000);
});

Discussion

Feel free to propose good uses for this method, or even drop us some suggestions for improvement! You can also join our mailing list to collaborate with other developers and get updates from us.