Módulo que sigue a medida que la página se desplaza PHP

I'm trying to make a Module that follows as page scrolls in PHP. I know that's not really that good at describing it, Let me try to do it a little better. So I need to have a box about 500X50 at the bottom of the user's page. As the user scrolls up or down the box is still at the bottom of the page. It moves with the page scrolls per say. I can't think of a way to do this. I only know PHP and HTML so I'd rather not have to work with js or jquery for this. If at all possible I'd love it to be able to be done in iframe, But from the documents I read about iframe it can't be done with iframe alone.

If you'd like to know why. I'm coding this for a MyBB forum, this box will display active forum info.

preguntado el 05 de mayo de 13 a las 21:05

You can do this with css. PHP is not needed. -

2 Respuestas

The appropriate tool for this is CSS, specifically position:fixed. Algo como esto:

#your-box {
     width:500px;
     height:50px;
     position:fixed;
     bottom:0;
}

In general, CSS is better than either PHP or HTML for defining cómo content should appear (as opposed to defining qué content should appear). That's what it's there for. You can read more about CSS positioning at Una lista aparte.

contestado el 05 de mayo de 13 a las 21:05

I think what you're trying to describe is position:fixed. I've put a sample here on JSfiddle, core CSS for styling the floating box and centering it horizontally on the bottom:

#floater {
    position:fixed;
    bottom:10px;
    color:white;
    text-align:center;
    height:1.5em;
    width:400px;
    left:50%;
    margin-left:-200px;
    background:navy;
    border:1px solid blue;
    box-shadow:2px 2px 2px rgba(0,0,0,0.25);
}

For completion's sake - the fact that I used a div is moot here. Make an iframe with id floater and it'll work the same, or put an iframe inside the div.

contestado el 05 de mayo de 13 a las 21:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.