SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Visible Ninja bronze trophy
    JeffWalden's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,709
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Pin a div element to the side

    The easiest way to explain what I'm looking for is to show you. So, have a look at www.waldenponder.com. You'll see that on the right hand side there I have a Follow Me twitter element. As you scroll down, the element is pinned to the side of the page.

    This particular script is written for this particular element and makes it easy to customize the color, etc. What I'm interested in is the bit of javascript (jQuery) that makes this possible. What function(s) should I be looking at to allow for a floating div which appears to be pinned to the side of a page?

    I've done my Google searching but am finding mainly sticky headers and footers which is not what I'm interested in. Basically, I just need to float a single div along the side of my content.

    Any help is appreciated.
    TAKE A WALK OUTSIDE YOUR MIND.

  2. #2
    SitePoint Zealot Gar onn's Avatar
    Join Date
    Feb 2011
    Location
    Belgium
    Posts
    130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would use the CSS fixed position
    position (CSS property)

    if you are a die hard jQuery fan:
    position absolute and change at scroll

    but I recommend fixed position

  3. #3
    Visible Ninja bronze trophy
    JeffWalden's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,709
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    That seems too simple! Thanks for the obvious answer that I somehow missed. I guess I was hung up on using javascript for it and forgot the basics.
    TAKE A WALK OUTSIDE YOUR MIND.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •