Search code examples
cssdrupaldrupal-blocks

Scroll block with page in drupal


Is it possible that if i scroll down on drupal the block should also scroll along with the page. Because i have to display long results on the node and i want to scroll the block so that user can see the data on left sidebar everytime.


Solution

  • If you don't need it to be animated, you can simply use the "position: fixed" CSS attribute.

    Assuming your block is 10px from the left, and 50px from the top it would look something like this:

    HTML

    <div class="scrolling-block">
        I can see you!
    </div>
    

    CSS

    .scrolling-block {
        position: fixed;
        left: 10px;
        top: 50px;
    }
    

    Also, check this out. http://www.cssplay.co.uk/layouts/fixed.html