I am having a watch video button which shows a YouTube video in color box. I want to show a form (webform/custom form) to appear after the video ends in the same color box itself. If users fill the form and submit it, the form should disappear, showing only the video that was ended in the colorbox. I am trying to achieve it using using the Youtube player API but not able to achieve my objective.

Is there some other way to achieve it?

1 Answer 1


That looks doable by youtube-api.

What you can do is have the form loaded already when you should the color box, with display: none on form block.

Now with help of youtube api you can detect video end and can toggle visibility to display: block;

Refer here for youtube api example:-

source https://stackoverflow.com/questions/7853904/how-to-detect-when-a-youtube-video-finishes-playing

Not the answer you're looking for? Browse other questions tagged or ask your own question.