简体   繁体   中英

How to add second close function to button?

Here I am using an API to open a livechat thing, I would like it so when they click it again, it closes it. The function for closing it is LC_API.close_chat_window();

Current code:

<li><a onclick="LC_API.open_chat_window();" href="javascript:void(0);"> CONTACT</a></li>
function openCloseChat() {
        if (LC_API.agents_are_available()) {
            if (LC_API.chat_window_minimized()) {
                LC_API.open_chat_window();
            } else {
                LC_API.minimize_chat_window();
            }
        } else {
            alert('No agent available.');
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM