Commit 32640e4360c7f6937f190cde0257a01a61fca895

Authored by Zambom
1 parent 58626f11

Closing participants list when click out

Showing 1 changed file with 24 additions and 0 deletions   Show diff stats
amadeus/static/js/chat.js
... ... @@ -4,6 +4,30 @@ $(document).on('hidden.bs.modal', '.modal', function () {
4 4 $('.modal:visible').length && $(document.body).addClass('modal-open'); //Fixing scroll bar for modals
5 5 });
6 6  
  7 +$(document).on("click", function (e) {
  8 + //console.log(e);
  9 + var container = $('#participants'),
  10 + $popover = $('.popover'),
  11 + list = container.parent().find(".participants-list");;
  12 +
  13 + if (!container.is(e.target) && container.has(e.target).length === 0
  14 + && !list.is(e.target) && list.has(e.target).length === 0
  15 + && !$popover.is(e.target) && $popover.has(e.target).length === 0) {
  16 + if (container.hasClass('open')) {
  17 + container.animate({
  18 + right : '0px'
  19 + }, 500);
  20 +
  21 + list.animate({
  22 + right : '-180px',
  23 + opacity: 0
  24 + }, 500).css({display: "none", visibility: 'hidden'});
  25 +
  26 + container.removeClass('open');
  27 + }
  28 + }
  29 +});
  30 +
7 31 $('#chat-modal-info').on('show.bs.modal', function (e) {
8 32 var header = $(this).find('.talk_header');
9 33 if (header.length > 0) {
... ...