Results 1 to 2 of 2

Thread: Slight change to an old DD script

  1. #1
    Join Date
    Jun 2014
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Slight change to an old DD script

    i have used this scroller on several sites and it works great. the problem is on a new site i want to scroll left to right instead of top to bottom....
    tnx in advance.

    Code:
    <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
    
    var Hoffset=#apos# //Enter buttons' offset from right edge of window (adjust depending on images width)
    var Voffset=40 //Enter buttons' offset from bottom edge of window (adjust depending on images height)
    var thespeed=6 //Enter scroll speed in integer (Advised: 1-3)
    
    var ieNOTopera=document.all&&navigator.userAgent.indexOf("Opera")==-1
    var myspeed=0
    
    var ieHoffset_extra=document.all? 15 : 0
    var cross_obj=document.all? document.all.staticbuttons : document.getElementById? document.getElementById("staticbuttons") : document.staticbuttons
    
    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_obj.style.left=parseInt(dsocleft)+parseInt(window_width)-Hoffset+"px"
    cross_obj.style.top=dsoctop+Voffset+"px"
    }
    else if (document.layers){
    cross_obj.left=dsocleft+window_width-Hoffset
    cross_obj.top=dsoctop+window_height-Voffset
    }
    }
    
    function scrollwindow(){
    window.scrollBy(0,myspeed)
    }
    
    function initializeIT(){
    positionit()
    if (myspeed!=0){
    scrollwindow()
    }
    }
    
    if (document.all||document.getElementById||document.layers)
    setInterval("initializeIT()",20)
    
    </script>
    Last edited by james438; 06-11-2014 at 11:03 PM. Reason: code format

  2. #2
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <style type="text/css">
    /*<![CDATA[*/
    .left {
      position:fixed;left:50px;bottom:50px;width:50px;height:50px;background-Color:red;
    }
    
    .right {
      position:fixed;right:50px;bottom:50px;width:50px;height:50px;background-Color:red;
    }
    
    /*]]>*/
    </style>.left
    </head>
    
    <body>
    
    <div class="left" onmouseover="scrollwindow.spd=-10;" onmouseout="scrollwindow.spd=0;"></div>
    <div class="right" onmouseover="scrollwindow.spd=10;" onmouseout="scrollwindow.spd=0;"></div>
    <div style="width:5000px;height:50px;background-Color:red" >
    
    </div>
    
    <script type="text/javascript">
    /*<![CDATA[*/
    
    function scrollwindow(){
     if (scrollwindow.spd&&typeof(scrollwindow.spd)=='number'){
      window.scrollBy(scrollwindow.spd,0);
     }
    }
    
    setInterval(function(){ scrollwindow(); },50);
    
    /*]]>*/
    </script>
    </body>
    
    </html>
    or

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <style type="text/css">
    /*<![CDATA[*/
    .left {
      position:fixed;left:50px;bottom:50px;width:50px;height:50px;background-Color:red;
    }
    
    .right {
      position:fixed;right:50px;bottom:50px;width:50px;height:50px;background-Color:red;
    }
    
    .up {
      position:fixed;left:50px;top:150px;width:50px;height:50px;background-Color:red;
    }
    
    .down {
      position:fixed;right:50px;top:150px;width:50px;height:50px;background-Color:red;
    }
    
    /*]]>*/
    </style>.left
    </head>
    
    <body>
    
    <div style="width:5000px;height:5050px;background-Color:blue" >
    </div>
    
    <div class="up" onmouseover="scrollwindow(0,-10);" onmouseout="scrollwindow();">Up</div>
    <div class="down" onmouseover="scrollwindow(0,10);" onmouseout="scrollwindow();">Down</div>
    
    <div class="left" onmouseover="scrollwindow(-10,0);" onmouseout="scrollwindow();">Left</div>
    <div class="right" onmouseover="scrollwindow(10,0);" onmouseout="scrollwindow();">Right</div>
    
    
    <script type="text/javascript">
    /*<![CDATA[*/
    
    function scrollwindow(x,y){
     clearTimeout(scrollwindow.to);
     if (typeof(x)=='number'&&typeof(y)=='number'){
      window.scrollBy(x,y);
      scrollwindow.to=setTimeout(function(){ scrollwindow(x,y); },50);
     }
    }
    
    
    /*]]>*/
    </script>
    </body>
    
    </html>
    Last edited by vwphillips; 06-11-2014 at 11:19 AM.
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

Similar Threads

  1. Photo Album script v2.0 - Looking for a Slight Tweak/Enhancement
    By BrettRobyCreativeDesign in forum Dynamic Drive scripts help
    Replies: 5
    Last Post: 10-19-2013, 10:58 AM
  2. Blending Image Slideshow Script (need slight help)
    By ksk226 in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 06-10-2010, 08:52 PM
  3. Need slight script modification please
    By 711 in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 04-17-2009, 02:48 PM
  4. Conveyor Belt Script is producing a slight jump
    By tronicuk in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 08-17-2008, 11:37 AM
  5. Slight change in a Dynamic Drive script?
    By phunctional in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 07-14-2006, 04:49 AM

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
  •