I have a JQuery UI dialog with a link in it. When the link is clicked, the dialog should close then move the screen/client window down the to footer div that contains contact details.
My Problem: The screen never moves to where I tell it to, it just stays where it is. The dialog closes correctly(so I know the javascript function is being called) but the client area doesn’t scroll-down/move/switch to the footer element. Information: the footer is at the base of the page & the page(body element) is about 2000px high.
What am I doing wrong & how can I get the screen to move the a certain element?
function moveToFooter()
{
$("body").scrollTop($("#footer").position().left+$("#footer").offset().left, $("#footer").position().top+$("#footer").offset().top);
// Just a simple test to move the screen anywhere doesn't work either:
$("body").scrollTop(300,2000);
}
scrollTop only takes one argument, the horizontal position. You’re giving it two.
Also, your adding the CSS position to the offset position of the footer. That doesn’t make any sense. For absolutely positioned elements, it might make a little sense, but not much.
So, the correct code should be