Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Sep 2003
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Emulated scrollbars

    I want to replace the scroll bar on my iframe with buttons. I've seen it done before but I'm not sure if it was with javascript. http://seducius.port5.com
    ~SiNa94~
    http://seducius.port5.com/
    "Stab...die!"

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    Kansas City, Kansas
    Posts
    1,518
    Thanks
    0
    Thanked 2 Times in 2 Posts

  • #3
    New Coder
    Join Date
    Sep 2003
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've gotten that much on my own, and a lot easier. But what I want is for it to keep scolling as long as they hold down the left mouse button, just like a real scrollbar. But then just use images instead of real scrollbars. Like this:


    <script>

    whereto = 0;

    function scrollup() {
    whereto = whereto-25;
    mainpage.scroll(0,whereto);
    }

    function scrolldown() {
    whereto = whereto+25;
    mainpage.scroll(0,whereto);
    }

    </script>

    <img src="" width="15" height="15" align="right" alt="Scroll up" onmousedown="scrollup();"><br>
    <img src="" width="15" height="15" align="right" alt="Scroll down" onmousedown="scrolldown();">

    <iframe src="home.html" name="mainpage">
    </iframe>


    Except, you have to click the button over and over to scroll, same as with the code on dyn-web. I want a nice smooth continuous scroll as long as they hold down the mouse button.
    ~SiNa94~
    http://seducius.port5.com/
    "Stab...die!"

  • #4
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try using setInterval to keep firing your function onmousedown and clearInterval onmouseup.

    .....Willy

  • #5
    New Coder
    Join Date
    Sep 2003
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Like this?

    <img src="" width="15" height="15" align="right" alt="Scroll up" onmousedown="setInterval('scrollup()', 10)" onmouseup="clearInterval()">
    <br>
    <img src="" width="15" height="15" align="right" alt="Scroll down" onmousedown="setInterval('scrolldown()', 10)" onmouseup="clearInterval()">
    ~SiNa94~
    http://seducius.port5.com/
    "Stab...die!"

  • #6
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Please try the following




    <HTML>
    <HEAD>
    <TITLE>Document Title</TITLE>

    <script>

    whereto = 0;

    function scrollup() {
    whereto -= 25;
    mainpage.scroll(0,whereto);
    scrollme=setTimeout("scrollup()",50)
    }

    function scrolldown() {
    whereto += 25;
    mainpage.scroll(0,whereto);
    scrollme=setTimeout("scrolldown()",50)
    }

    function stop_me(){
    clearTimeout(scrollme)
    }
    </script>




    </HEAD>
    <BODY>

    <img src="pic01.jpg" width="15" height="15" align="right" alt="Scroll Up" onmousedown="scrollup()" onmouseup="stop_me()"><br>
    <img src="pic02.jpg" width="15" height="15" align="right" alt="Scroll Down" onmousedown="scrolldown()" onmouseup="stop_me()">

    <iframe src="home.html" name="mainpage" style="height:100px"></iframe>

    </BODY>
    </HTML>
    Last edited by Mr J; 03-22-2004 at 07:08 PM.

  • #7
    New Coder
    Join Date
    Sep 2003
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks so much...works like a charm...
    ~SiNa94~
    http://seducius.port5.com/
    "Stab...die!"


  •  

    Posting Permissions

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