Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to create a video plugin which is fixed on the home page when user scrolls. I know there is a wp_float plugin . But I want to try build new plugin

share|improve this question
    
What is your specific question? –  toscho Mar 21 '13 at 10:56

1 Answer 1

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).

share|improve this answer
    
Thanks Marc. But this widget will goto footer are the sidebar. where to place the widget? –  B L Praveen Mar 26 '13 at 10:42
    
It doesn't matter where you place the widget code, because the CSS will make it float to where you specify, regardless of the position of the HTML elements in your code. You should try to put a little more effort in making clear what you want if you want people to help you. –  Marc Dingena Mar 26 '13 at 14:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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