Reputation: 4962
.draggable()
doesn't work directly on the embedded iframe$('#wrapper').draggable();
//$('iframe').draggable(); does not work
.overlay {
position: absolute;
width: 560px;
height: 315px;
background: rgba(0, 0, 0, .5);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.13.2/jquery-ui.min.js"></script>
<div id="wrapper">
<!--<div class="overlay"></div> this is needed unfortunately in order for draggable to work -->
<iframe width="560" height="315" src="https://www.youtube.com/embed/HgvIox6ehkM?controls=0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
Upvotes: 0
Views: 584
Reputation: 517
I did something similar and used thumbnail youtube api + YT player. I put the thumbnail with a higher z-index (position:absolute) on the iframe that is below it. When I click the play button I hide the thumbnail (I used custom play button on thumbnail).
Upvotes: 1