WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [closed] How to create a "sticky" widget in the sidebar? (7 posts)

  1. Sunnyj
    Member
    Posted 1 year ago #

    You know how some websites have an element that follows as you scroll down the page? How is that done?

    for example on the right sidebar:

    http://wpmu.org/wordpress-themes-you-should-never-use/

    How does that blue skyscraper banner follow down the page as you scroll?

  2. jnhghy
    Member
    Posted 1 year ago #

    Hi Sunnyj,
    That element it's not actually in the sidebar, it's usually in the header file, and it's a css trick: position: fixed;
    Check the info page above and try it!
    Regards

  3. Sunnyj
    Member
    Posted 1 year ago #

    Yes but it switches from absolute to fixed once the top of the screen scrolls down and touches its top. Very clean, doesn't overlap anything and only moves into fixed position once you've scrolled down on it. Most of the ones I've seen also automatically switch back to absolute position when it reaches the footer to avoid overlapping it.

    Anyone know how that's done?

  4. jnhghy
    Member
    Posted 1 year ago #

    Check jquery to change the attribute of an html element.
    You can check this for some info.
    Regards

  5. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    Set also a top and bottom:
    Example:

    top: 25px;
    bottom: 25px;

    may not work in older browsers

  6. Sunnyj
    Member
    Posted 1 year ago #

    Thanks guys, I got it working.

  7. Max Bond
    Member
    Posted 1 year ago #

    Hi guys!

    Try this new plugin: Q2W3 Fixed Widget

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.