cabennett85/gittest — Issue #946: Fix left navigation to top of the screen after scrolling down
Author: cabennett85
Created: 2012-03-02 00:26:51+00:00
State: open

"UI Pop"

interface
{{{
new KeepVisible(elem, {
nonOverlappingElements: [header, footer]
});

1. 'elem' can be the id of the element, or the DOM element object.

2. 'nonOverlappingElements' is an array of ids or DOM objects of elements that 'elem' should never overlap with.
}}}

behavior
{{{
1. if the keep visible element reaches the top of the page (based on user scrolling) AND if the viewport is at least as tall as the element itself, then the element should stick to the top (style position:fixed)

2. if the keep visible element hits another element among the array of "nonOverlappingElements" (such as the header or footer of the page), then it should stick to the edge of the element rather than overlapping with it (style position:absolute)

3. the behavior only needs to apply to vertical scrolling.
}}}

requirements:
{{{
1. The class should be built as a Prototype class.
2. The code should not corrupt the global namespace with any other identifiers besides the name of the class, KeepVisible.
3. The code should not overwrite or modify any of the DOM elements in any way.
4. The code should use JavaScript best practices.
5. The code should work in all major browsers.
}}}