SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Addict Scott Blanchard's Avatar
    Join Date
    Sep 2010
    Posts
    314
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do they do this. position: scroll fixed?

    On this cnet.com page, how do they program the "social sharing" div (you'll see it over on the left side), so that it scrolls until it reaches the top of the viewport, then its fixed until it reaches the footer?

    Any ideas?

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,592
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    It's done with JavaScript, but there are so many dang scripts on that page I can't see which one it is. I'll move this to the JS forum so someone with better eyes can help you.

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by ralph.m View Post
    It's done with JavaScript, but there are so many dang scripts on that page I can't see which one it is. I'll move this to the JS forum so someone with better eyes can help you.
    It's the code in the news.tron..post.compressed.js file, of which a part of the mootools code contains:

    Code javascript:
    var ShareBar = new Class({
        Extends: Fixation,
        Implements: [Options, Events],
        options: {
            defaultView: "side",
            enableToggle: true,
            barId: "shareBar",
            views: {
    ...

    If you're more used to jQuery, there's the floater plugin which does the job well too.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #4
    SitePoint Addict Scott Blanchard's Avatar
    Join Date
    Sep 2010
    Posts
    314
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the help guys. I was hoping they were somehow doing it with CSS3

    Still holding out hope that Paul O might reach into his bag o tricks for an unscripted, CSS solution, but I kinda doubt there is one to be had.


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
  •