Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By stuartgoff on
I would like to create a block that will scroll down the page as user scrolls down the page. My guess is that I can create a block in the admin>blocks that will follow the weights of the other blocks (this will be the "last" block.) and in the template.php setup some code that will check the location of that specific block and when the position gets to say 10px from the top of the window to set the position attributes to an absolute placement. At that point the block will always be say 10px from the top of the window.
Any ideas?
Stuart
Comments
I'm guessing
it's going to take some Java scripting. But I'd like to know the correct answer too.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru
No javascript!
I know there's a way to do it using CSS. Something like position: absolute
See http://www.w3.org/Style/CSS/
and
http://www.w3.org/TR/CSS21/visuren.html#absolute-positioning
yes that's what i think
yes that's what i think -but- it would need to change to that "absolute" attribute only after that block starts to reach the top of the page. Until then, I need the block needs to keep it's place.
How about...
How are you going to change it's position? You'll need a script to do that. CSS won't do it.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru
.
You do need to create a new region for this block. Then you can set the positioning and have the block stay at the same place. Anybody remember the old theme garden, where the chair and the water hose were always at the bottom? I have seen this done a number of times.
Here is one I think is similar to what you are looking for: http://www.opendesigns.org/preview/?template=658