Close video modal when clicking inside the fade.

Discussion in 'JavaScript' started by Zoti Media Group, Mar 11, 2018.

  1. #1
    When am clicking the X it closes but when am missing the X the video runs in background.

    Here is what am using:
    https://jsfiddle.net/ectanq7z/6/

    When the X is clicked the video stops but when I click outside the popup the video continues to run in background and this should be paused when the modal is hiden.

    Thank yo very much!
     
    Last edited: Mar 11, 2018
    Zoti Media Group, Mar 11, 2018 IP
  2. hdewantara

    hdewantara Well-Known Member

    Messages:
    538
    Likes Received:
    47
    Best Answers:
    25
    Trophy Points:
    155
    #2
    If you need a click outside modal popup to behave the same then try to extend an example from this link:
    https://getbootstrap.com/docs/3.3/javascript/#modals-events

    And so I guess the additional code may look like the following:
    ...
    $('#videoModal').on('hidden.bs.modal', function (e) {
      // do something...
      $(this).find('iframe').attr('src','');
    })
    ...
    Code (JavaScript):
    It has been quite long since I stopped playing with bootstrap though.
    Good luck :)
     
    hdewantara, Mar 11, 2018 IP
  3. Zoti Media Group

    Zoti Media Group Notable Member

    Messages:
    1,599
    Likes Received:
    113
    Best Answers:
    2
    Trophy Points:
    265
    Digital Goods:
    2
    #3

    Thank you very much! When am trying on jdfiddle its working, once am putting the code into my website its not working :)
     
    Zoti Media Group, Mar 11, 2018 IP
  4. saveyou

    saveyou Active Member

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #4
    I guess there is another script that make your script not work, try to clean up your code first and start from there
     
    saveyou, Nov 15, 2018 IP