www.webdeveloper.com
Results 1 to 6 of 6

Thread: anyone can help me change the script to scroll sideways

  1. #1
    Join Date
    Aug 2012
    Location
    Guangzhou, China
    Posts
    6

    Question anyone can help me change the script to scroll sideways

    That is the script I use from www.dynamicdrive.com to scroll down with custom scrollers (since I can't get into that websites forum), I would really appreciate if anyone could change the script to make it scroll sideways (horizontal scrolling), since I am a total newbie I really don't know at all what is what. Hope to get a reply soon.

    <div id="staticbuttons" style="position:absolute;">
    <a href="javascript:" onmouseover="myspeed=-thespeed" onmouseout="myspeed=0"><img
    src="arrows_up.gif" border="0"></a><br>
    <a href="javascript:" onmouseover="myspeed=thespeed" onmouseout="myspeed=0"><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

    var Hoffset=70 //Enter buttons' offset from right edge of window (adjust depending on images width)
    var Voffset=80 //Enter buttons' offset from bottom edge of window (adjust depending on images height)
    var thespeed=3 //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+parseInt(window_height)-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>

  2. #2
    Join Date
    Mar 2007
    Location
    U.K.
    Posts
    1,127
    That is the script I use from www.dynamicdrive.com
    You really need to stay away from that site and it's shamefully outdated scripts. Can you give the exact URL of the demo, so that at least I can see what it's supposed to do?
    Where used, return should be executed unconditionally and always as the last statement in the function.

    That's my signature, it's not part of the damn post!

  3. #3
    Join Date
    Aug 2012
    Location
    Guangzhou, China
    Posts
    6
    http://www.dynamicdrive.com/dynamici...gescroller.htm
    Its supposed to be a custom scroller, and like I said am a total newbie xD
    It be really really helpful if you could recommend me some new websites with good scripts

  4. #4
    Join Date
    Mar 2007
    Location
    U.K.
    Posts
    1,127
    Quote Originally Posted by wishfulthought View Post
    http://www.dynamicdrive.com/dynamici...gescroller.htm
    Its supposed to be a custom scroller, and like I said am a total newbie xD
    It be really really helpful if you could recommend me some new websites with good scripts
    You can evaluate this script: http://scripterlative.com/files/slidescroll.htm , which provides similar functionality for scrolling divs, iframes or entire pages.
    Where used, return should be executed unconditionally and always as the last statement in the function.

    That's my signature, it's not part of the damn post!

  5. #5
    Join Date
    Mar 2012
    Location
    Shanghai, China
    Posts
    4

    Smile scrolling implementation based on the that on www.dynamicdrive.com

    Hi wishfulthought,

    Maybe you can refer to the attachments about implementing scroll sideways.
    I have tested it using Firefox and IE9.

    Hope it is what you want.
    Attached Files Attached Files

  6. #6
    Join Date
    Jun 2004
    Location
    Portsmouth UK
    Posts
    2,661
    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;right:100px;bottom:100px;
    }
    
    .right {
      position:fixed;right:50px;bottom:100px;
    }
    
    /*]]>*/
    </style></head>
    
    <body>
    <div style="width:3000px;height:50px;" ></div>
    <div id="staticbuttons" style="position:absolute;">
    <a href="javascript:" onmouseover="myspeed=-thespeed" onmouseout="myspeed=0"><img  class="left"
    src="arrows_up.gif" border="1" width="40" height="40"></a><br>
    <a href="javascript:" onmouseover="myspeed=thespeed" onmouseout="myspeed=0"><img class="right"
    src="arrows_dn.gif" border="1" width="40" height="40"></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
    
    var thespeed=3 //Enter scroll speed in integer (Advised: 1-3)
    var myspeed=0
    
    
    function scrollwindow(){
     window.scrollBy(myspeed,0)
    }
    
    function initializeIT(){
     if (myspeed!=0){
      scrollwindow()
     }
    }
    
    setInterval("initializeIT()",20)
    
    </script>
    
    </body>
    
    </html>
    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/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles