Piotr Zalewa
2007-Jun-05 12:46 UTC
Prototype: How to display a div placed in browser window on long page?
Hi I want to put an "edit item" div on a pretty long item list. How to make it always visible in the browser even if the list will be scrolled? (aka CSS: fixed property) Thanks Piotr --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Diodeus
2007-Jun-08 14:23 UTC
Re: Prototype: How to display a div placed in browser window on long page?
1) Get the y position of the DIV 2) window.scrollTo(0, y) I use the following to do this: var myPos = findPos($(''someDIV'')) window.scrollTo(0, myPos[1]) function findPos(obj) { var curleft = curtop = 0; if (obj.offsetParent) { curleft = obj.offsetLeft curtop = obj.offsetTop while (obj = obj.offsetParent) { curleft += obj.offsetLeft curtop += obj.offsetTop } } return [curleft,curtop]; } On Jun 5, 8:46 am, Piotr Zalewa <zal...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi > > I want to put an "edit item" div on a pretty long item list. > How to make it always visible in the browser even if the list will be > scrolled? (aka CSS: fixed property) > > Thanks > > Piotr--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---