1

I am searching for a way to make a block behave as a drupal-highlighted area, similar to the header here. In other words, stick to the header and move along as the user roles down.

I was wondering if there is either a module that can do that, to sort of wrap the block's content or a custom workaround in my module.

I know that there exist some themes which can do that, but I would like to implement a theme-free solution.

Thanks!

7

This is just a CSS thing! There a tutorial here on how to achieve it, but you're pretty much just looking at some CSS like the following.

Edit: The tutorial has now gone, but the CSS contained is very similar to that shown below, and a quick search in your favourite search engine will return similar results.

#BLOCKID {
    position: fixed;
    top: 0;
    left: 0;
    height: 160px;
}

Just apply the CSS to your chosen block and you're off.

5
  • 1
    In case someone wants to achieve the same as me, I only extented slightly by adding to my custom css this : html, body, #page{ margin-top:70px; top: 70px; } which moves the rest of the page downward! Thanks Chapabu! Jun 21 '12 at 14:08
  • 1
    keep in mind that every mobile browser implements position:fixed in a different manner. Jun 27 '12 at 21:05
  • Not just mobile browsers. Some desktop browsers react differently as well.
    – Chapabu
    Jun 27 '12 at 21:23
  • Hello. Your tutorial link is out of date.
    – Mołot
    Jan 22 '14 at 8:22
  • @Mołot Cheers :-)
    – Chapabu
    Jan 22 '14 at 9:01
2

Try this: https://drupal.org/project/floating_block. It works fine and it's easy to use.

The Floating block module allows you to keep html blocks, selected using jquery selectors in a fixed position on the page as you scroll. It works in a similar way the table header fixer in Drupal Core. This means that when the user scrolls their browser selected parts of the page can stay in the users view.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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