# EventListener on participant or chat click

**URL:** <https://devforum.zoom.us/t/eventlistener-on-participant-or-chat-click/46453>\
**Category:** Web\
**Created:** [March 24, 2021, 12:50pm UTC](https://devforum.zoom.us/t/eventlistener-on-participant-or-chat-click/46453 "2021-03-24T12:50:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris.w](https://avatars.discourse-cdn.com/v4/letter/c/ad7895/32.png) [@chris.w](https://devforum.zoom.us/u/chris.w)\
**Post date:** [March 24, 2021, 12:50pm UTC](https://devforum.zoom.us/t/eventlistener-on-participant-or-chat-click/46453/1 "2021-03-24T12:50:17Z")

</div>

**Description**  
Hi, this may be a basic question but I’m integrating zoom into our website and have created an overlay when a button is clicked that sits on on top of the video, using mainly z-index. However, when this is active I can’t get the chat window to the front again. I think my preferred solution would be when the user clicks the participant or chat buttons in the footer it resizes my overlay accordingly, then there would be no reason to bring the chat to front. Is this even possible? If so what would be the best method to implement this? If there also a function to launch the chat window as soon as a participant joins? Appreciate any help.

**Which Web Client SDK version?**  
1.9.1

 ![zoom screenshot](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/2/1/210f84be2da1c9c2ccc7ec0e41e5f2988f796dce.png)  
**Device (please complete the following information):**  
Any browser - using chrome

---

<div class="post-metadata">

**Author:** ![alexmayo](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/alexmayo/32/27289_2.png) [@alexmayo](https://devforum.zoom.us/u/alexmayo)\
**Post date:** [March 24, 2021, 2:47pm UTC](https://devforum.zoom.us/t/eventlistener-on-participant-or-chat-click/46453/2 "2021-03-24T14:47:38Z")

</div>

Hi @chris.w,

Welcome to the community!

The best thing to do would probably be to listen for width changes on the window, and also clicks on certain buttons. The below should be a copy-and-paste solution for you. Just need to update the class name to match that of your overlay.

```auto
//Update the overlay's width when the window is resized.
$(window).on('resize', function() {
  updateCustomOverlayWidth();
});

//Update the overlay's width when a toolbar button or a close/popout button is clicked.
$('.footer-button__button, .dropdown-menu li a').on('click', function() {
  updateCustomOverlayWidth();
});

//Update the custom overlay's width.
function updateCustomOverlayWidth() {
  let w = $('.wc-container-left').width;
  $('.overlay-class').width(w);
}

```

There are no built-in methods to launch the chat window as soon as a participant joins, but you could add the following to your join callback or event, so that it automatically opens when the attendee joins.

```auto
$('.footer-button__chat-icon').closest('button').trigger('click');

```

Thanks,  
Alex

_P.S. The Zoom SDK is updated regularly, so the above snippets may not work with future releases of the Zoom Web SDK. These scripts were tested with v1.9.1._

---

<div class="post-metadata">

**Author:** ![chris.w](https://avatars.discourse-cdn.com/v4/letter/c/ad7895/32.png) [@chris.w](https://devforum.zoom.us/u/chris.w)\
**Post date:** [March 24, 2021, 3:17pm UTC](https://devforum.zoom.us/t/eventlistener-on-participant-or-chat-click/46453/3 "2021-03-24T15:17:44Z")

</div>

Thanks so much - marked it as solution. Really appreciate it.

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [March 25, 2021, 3:23pm UTC](https://devforum.zoom.us/t/eventlistener-on-participant-or-chat-click/46453/4 "2021-03-25T15:23:49Z")

</div>

Glad @alexmayo could help, @chris.w 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [April 25, 2021, 1:24am UTC](https://devforum.zoom.us/t/eventlistener-on-participant-or-chat-click/46453/5 "2021-04-25T01:24:13Z")

</div>

Closed on April 25, 2021, 1:24am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
