View Full Version : Script: Page Scroller (aka Custom Scrollbar) - Would like to tweak
Das Christoff
03-23-2006, 09:18 PM
Script: Page Scroller (aka Custom Scrollbar)
http://dynamicdrive.com/dynamicindex2/pagescroller.htm
This script is great, it's almost exactly what I am looking for. There are only 2 things I am trying to change.
1: Instead of having the page start sliding on mouseover, I would like to have it move a set amount (ie 50px) just once on mouseclick.
2: I would like to have the up arrow at the top of that page, while keeping the down arrow at the bottom.
Basically, I am trying to replace the standard scrollbars with two images that move the info up or down. There may be a script out there that does exactly this, but I haven't found it yet.
jscheuer1
03-24-2006, 03:55 AM
<div id="staticbuttons2" style="position:absolute;">
<a href="javascript:scrollwindow('-')"><img
src="arrows_up.gif" border="0"></a>
</div>
<div id="staticbuttons" style="position:absolute;">
<a href="javascript:scrollwindow('+')"><img
src="arrows_dn.gif" border="0"></a>
</div>
<script>
//Page Scroller (aka custom scrollbar)- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use
//Modified here for top and bottom buttons & onclick activation by
//jscheuer1 in http://www.dynamicdrive.com/forums
var Hoffset=70 //Enter buttons' offset from right edge of window (adjust depending on images width)
var Voffset=60 //Enter button's offset from bottom edge of window (adjust depending on images height) Half this value will be added as top button's offset from top
var theamount=50 //Enter scroll amount per click as integer (Advised: 25-50)
var ieNOTopera=document.all&&navigator.userAgent.indexOf("Opera")==-1
var myspeed=0
var ieHoffset_extra=ieNOTopera? 15 : 0
var cross_obj=document.all? document.all.staticbuttons : document.getElementById? document.getElementById("staticbuttons") : document.staticbuttons
var cross_obj2=document.all? document.all.staticbuttons2 : document.getElementById? document.getElementById("staticbuttons2") : document.staticbuttons2
function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function positionit(){
var dsocleft=document.all? iecompattest().scrollLeft : pageXOffset
var dsoctop=document.all? iecompattest().scrollTop : pageYOffset
var window_width=ieNOTopera? iecompattest().clientWidth+ieHoffset_extra : window.innerWidth+ieHoffset_extra
var window_height=ieNOTopera? iecompattest().clientHeight : window.innerHeight
if (document.all||document.getElementById){
cross_obj2.style.left=cross_obj.style.left=parseInt(dsocleft)+parseInt(window_width)-Hoffset+"px"
cross_obj.style.top=dsoctop+parseInt(window_height)-Voffset+"px"
cross_obj2.style.top=dsoctop+Voffset/2+"px"
}
else if (document.layers){
cross_obj2.left=cross_obj.left=dsocleft+window_width-Hoffset
cross_obj.top=dsoctop+window_height-Voffset
cross_obj2.top=dsoctop+Voffset/2
}
}
function scrollwindow(dir){
if (dir=='-')
window.scrollBy(0,theamount*-1)
else
window.scrollBy(0,theamount)
}
function initializeIT(){
positionit()
}
if (document.all||document.getElementById||document.layers)
setInterval("initializeIT()",20)
</script>
Das Christoff
03-24-2006, 05:55 PM
That's perfect. Thanks a lot.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.