How to create wordpress widget that is fixed position on the home page

You can achieve this with pure CSS. It’s a solid alternative to your question.

Depending if your widget has a unique ID (like id="widget-358" or id="my-video-widget"), you can set up CSS rules to make it float in a fixed position on the screen:

#my-video-widget {
    /* required */
    position: fixed;

    /* change to your needs */
    top: 0px; /* to float it from the bottom of the screen, use the 'bottom' directive */
    left: 0px; /* to float it on the right hand side, use the 'right' directive */

    /* optional */
    z-index: 10; /* depends if elements on your page are already layered, and if you want your video to float above everything else */
}

If your widget does not have a unique identifier, you may risk affecting other widgets or elements, so I advise you put a unique name in either the class or id (id makes much more sense).

tech