Turn Videos Into Minimized Sticky Videos Upon Scroll

Modified on: Fri, 16 Apr, 2021 at 11:26 AM


Example Java/HTML Code:


<style>
 .test
 {
 position: fixed !important;
 top: 0 !important;
 left: 0 !important;;
 right: 0 !important;;
  z-index:999 !important;
  width:300px !important;
  height:200px !important;
 }
</style>
<script>
window.onscroll = function() {myFunction()};
function myFunction() {
 if (document.body.scrollTop > 90 || document.documentElement.scrollTop > 90) {
  document.getElementById("video-PUTHERETHECSSVIDEOSELECTORCODE").className = "test";
 } else {
  document.getElementById("video-PUTHERETHECSSVIDEOSELECTORCODE").className = "";
 }
}
</script>


Example CSS:


#video-PUTHERETHECSSVIDEOSELECTORCODE {
 float: left;
}


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article