Resolution: Keep element in view while scrolling using jQuery

I have to keep the element in view while scrolling. i have done it and it's working fine in all the browser, but not wise resolution wise.

   $(function() {
            var offset = $(".sysIcons").offset();
            var topPadding = 15;
            $(window).scroll(function() {
                if ($(window).scrollTop() > offset.top) {
                    $(".sysIcons").stop().animate({
                        marginTop: $(window).scrollTop() - offset.top + topPadding
                    });
                } else {
                    $(".sysIcons").stop().animate({
                        marginTop: 0
                    });
                };
            });
        });

it's working fine in 1024 x 768, 1280 x 735,

But not in 1360X768, - problem is while scrolling till at the end of the window, it will not stop. continuously animate while scrolling.

please help me out

Answers


This might do what you are looking for.

http://imakewebthings.github.com/jquery-waypoints/sticky-elements/

Main site: http://imakewebthings.github.com/jquery-waypoints/


You don't need jQuery to get element in view while scrolling, you can use CSS position property to make it appear all the time including scrolling:

#elementID {
  position:fixed;
  /* more styles */
}

position:fixed does not work in IE6 but who cares about it these days :)


Need Your Help

How do you specify git URLs with spaces on Windows under cygwin?

git url cygwin whitespace filenames

If I have a git repository under cygwin with a directory name of the form /cygdrive/c/Documents and Settings/user/My Documents/My Dropbox/xxxxx how do I construct a file: URL for git that reference...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.