Results 1 to 3 of 3

Thread: Script: Page Scroller (aka Custom Scrollbar) - Would like to tweak

  1. #1
    Join Date
    Mar 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Script: Page Scroller (aka Custom Scrollbar) - Would like to tweak

    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.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Code:
    <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>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Mar 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thanks

    That's perfect. Thanks a lot.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •