You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Gwyn Evans <gw...@gmail.com> on 2007/10/10 21:57:11 UTC

Scrolling browser to newly visible panel?

Just wondering if there was anything that might help with the
following?

In a web page design I've been given, I may need to display an
'options' form to get additional input.  I'm doing this with Ajax,
but the problem is that it typically appears off the bottom of the
existing page - is there a good way of triggering the browser to do
something like scroll down, ideally to the bottom of the new form?

-- 
Best regards,
 Gwyn                          mailto:gwyn.evans@gmail.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Scrolling browser to newly visible panel?

Posted by Nathan Hamblen <na...@technically.us>.
Gwyn Evans wrote:
 > I'm doing this with Ajax,
 > but the problem is that it typically appears off the bottom of the
 > existing page - is there a good way of triggering the browser to do
 > something like scroll down, ideally to the bottom of the new form?

findpos(elem) has worked well for me on ajax-added elements:
http://www.quirksmode.org/js/findpos.html

Also this is good for the scrolling part:
http://www.quirksmode.org/viewport/compatibility.html

And then if you wanted to animate the scrolling, and also wonder why 
this seemingly common need is not addressed by popular effects 
libraries, there's:
http://technically.us/code/x/dragging-and-dropping-effects

Nathan



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Scrolling browser to newly visible panel?

Posted by Gerolf Seitz <ge...@gmail.com>.
i found two possibilities to do this (although i haven't tried it with
wicket ajax):

var el = document.getElementById('panelInsertedViaAjax');
1)
document.getElementsByTagName('body')[0].scrollTop = el.offsetTop + el
.offsetHeight;
2)
el.scrollIntoView(false);
// false to position it to the bottom of the page
// true for the top

Gerolf


On 10/10/07, Gwyn Evans <gw...@gmail.com> wrote:
>
> Just wondering if there was anything that might help with the
> following?
>
> In a web page design I've been given, I may need to display an
> 'options' form to get additional input.  I'm doing this with Ajax,
> but the problem is that it typically appears off the bottom of the
> existing page - is there a good way of triggering the browser to do
> something like scroll down, ideally to the bottom of the new form?
>
> --
> Best regards,
> Gwyn                          mailto:gwyn.evans@gmail.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>