[Release] Scroll to Top / Middle / Bottom of page

General questions about scripts and buttons should be asked here. Development scripts and buttons may also be posted for feedback.

Moderators: Support Staff², Support Staff, AvantGuard, Developer

Post Reply
Scrabble
Semi-Fan
Semi-Fan
Posts: 68
Joined: Sat Nov 18, 2006 10:36 pm
Windows Version: Windows
Avant Version:

[Release] Scroll to Top / Middle / Bottom of page

Post by Scrabble » Sat Dec 30, 2006 7:44 am

You can create a button to scroll to either the top, middle, or bottom of the current web page with a press of a button by going to Tools...Avant Browser Options...Add-Ons...Add-Ons. Then click add, give it a name, select an icon to identify it, make sure for "Type" that the 'Script Button' is selected, then paste the text below into the 'Content' field:

FOR GOING TO THE TOP OF THE PAGE:

javascript:top.window.scrollTo(0,0);




FOR GOING TO THE MIDDLE OF THE PAGE:

var winWidth = (document.body.clientWidth);
var winHeight = (document.body.clientHeight);
window.scrollTo(winWidth,winHeight/2);




FOR GOING TO THE BOTTOM OF THE PAGE:

var winWidth = document.body.clientWidth;
var winHeight = document.body.clientHeight;
window.scrollTo(winWidth,winHeight);

Scrabble
Semi-Fan
Semi-Fan
Posts: 68
Joined: Sat Nov 18, 2006 10:36 pm
Windows Version: Windows
Avant Version:

Re: Scroll to Top / Middle / Bottom of page

Post by Scrabble » Sat Dec 30, 2006 7:57 am

CORRECTION:

SCRIPT TO ENSURE YOU SCROLL TO THE BOTTOM OF THE PAGE IS:

var winWidth = (document.body.clientWidth);
var winHeight = (document.body.clientHeight);
window.scrollTo(winWidth*100000,winHeight*100000);



I FOUND THAT NOT ALL WEB PAGES WERE RESPONDING AS THEY SHOULD. I HAVE NOT COME UP WITH A FIX FOR SCROLLING TO THE MIDDLE OF THE PAGE YET.

alexas
Newbie
Newbie
Posts: 11
Joined: Mon Dec 19, 2005 12:34 pm
Avant Version:

Post by alexas » Thu Jun 21, 2007 11:27 pm

it's not working in some cases, GMAIL for one.

can Javascript simulate keypress like HOME and END?
I Stand Corrected

Post Reply