Revision: 8004
Updated Code
at October 30, 2008 14:37 by wizard04
Updated Code
//native elem.scrollIntoView() works similar to an #anchor, putting top-left of element at top-left of viewport //set document scroll position //optionally, specify a particular window/frame function setDocumentScrollPosition(top, left, windowFrame) { windowFrame = windowFrame || window; var w = new WindowDimensions(windowFrame); if(isNaN(top)) top = w.window.scroll.top; if(isNaN(left)) left = w.window.scroll.left; //note: window.pageX/YOffset is read-only; the other two seem to depend on whether the browser is in quirks mode or not windowFrame.document.body.scrollLeft = left; windowFrame.document.documentElement.scrollLeft = left; windowFrame.document.body.scrollTop = top; windowFrame.document.documentElement.scrollTop = top; } //set element scroll position function setScrollPosition(elem, top, left) { elem.scrollLeft = left; elem.scrollTop = top; } var scrollUP, panDown, scrollDown, panUp, scrollLeft, panRight, scrollRight, panLeft; scrollUp = panDown = function(elem, distance){ elem.scrollTop -= distance; }; scrollDown = panUp = function(elem, distance){ elem.scrollTop += distance; }; scrollLeft = panRight = function(elem, distance){ elem.scrollLeft -= distance; }; scrollRight = panLeft = function(elem, distance){ elem.scrollLeft += distance; };
Revision: 8003
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 26, 2008 13:26 by wizard04
Initial Code
//native elem.scrollIntoView() works similar to an #anchor, putting top-left of element at top-left of viewport //set document scroll position //optionally, specify a particular window/frame function setDocumentScrollPosition(left, top, windowFrame) { windowFrame = windowFrame || window; //note: window.pageX/YOffset and document.documentElement.scrollLeft/Top are read-only windowFrame.document.body.scrollLeft = left; windowFrame.document.body.scrollTop = top; } //set element scroll position function setScrollPosition(elem, left, top) { elem.scrollLeft = left; elem.scrollTop = top; } var scrollUP, panDown, scrollDown, panUp, scrollLeft, panRight, scrollRight, panLeft; scrollUp = panDown = function(elem, distance){ elem.scrollTop -= distance; }; scrollDown = panUp = function(elem, distance){ elem.scrollTop += distance; }; scrollLeft = panRight = function(elem, distance){ elem.scrollLeft -= distance; }; scrollRight = panLeft = function(elem, distance){ elem.scrollLeft += distance; };
Initial URL
Initial Description
Initial Title
Scrolling functions
Initial Tags
javascript
Initial Language
JavaScript