The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

How can i make a friendfeed like window scrollcontrol system

  • # December 25, 2009 at 5:13 pm

    When you active real-time updates, new entries dynamically adding a div. At this stage scroll is automatically moving. This action provides the content you do not miss on visible area.

    If you want to see this action, you can also watch this screencast;

    My method;

    // Firstly, i am storing the first entry’s(in view) positions in window object;
    jQuery(window).scroll(function() {
    var q = 0;
    jQuery(“.entry”).each(function (i) {
    if (jQuery(this).offset().top > jQuery(window).scrollTop()) {
    if (q == 0) {
    window.show_id = jQuery(this).attr(“id”);
    window.pos_y = jQuery(this).offset().top – jQuery(window).scrollTop();
    q = 1;

    // After coming to the new entry, i call this function;
    function scroll_control() {
    var scroll_top = jQuery(window).scrollTop();
    if (scroll_top != 0) {
    if (jQuery(‘#’+window.show_id).length != 0) {
    var scr = jQuery(‘#’+window.show_id).offset().top – window.pos_y;
    window.scrollTo(0, scr);

    But this is due to flashing. I guess this method is not fast enough

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed