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 5 of 5
  1. #1
    New Coder
    Join Date
    Jan 2007
    Posts
    64
    Thanks
    0
    Thanked 1 Time in 1 Post

    Scrollbar as a percentage

    Does anyone know how to accomplish this?

    I've done it but the document.body.scrollTop surpasses clientHeight?

    Is there something special I need to do?
    Here's what I have that doesnt work
    Code:
    if (navigator.appName == "Microsoft Internet Explorer"){var currentLocation =   document.body.scrollTop;}
    else{var currentLocation =  window.pageYOffset; }
    			
    var windowHeight = document.body.clientHeight;
    		
    var percentage = currentLocation/windowHeight * 100;
    No trees were harmed in the transmission of this message.
    However, a rather large number of electrons were temporarily
    inconvenienced.

  • #2
    New Coder
    Join Date
    Jan 2007
    Posts
    64
    Thanks
    0
    Thanked 1 Time in 1 Post
    Can this even be done?
    No trees were harmed in the transmission of this message.
    However, a rather large number of electrons were temporarily
    inconvenienced.

  • #3
    Regular Coder GSimpson's Avatar
    Join Date
    Aug 2006
    Location
    New Zealand
    Posts
    268
    Thanks
    9
    Thanked 0 Times in 0 Posts
    I'm personally not sure but I don't think that it would be a good way to have your UI anyway. Usually websites that rely on javascript like dropdown menus for navigation (<option>) and things like buttons for navigation and alerts on welcome can be a real put off to your website, as it comes across on a non-personal level.

  • #4
    New Coder
    Join Date
    Jan 2007
    Posts
    64
    Thanks
    0
    Thanked 1 Time in 1 Post
    Quote Originally Posted by GSimpson View Post
    I'm personally not sure but I don't think that it would be a good way to have your UI anyway. Usually websites that rely on javascript like dropdown menus for navigation (<option>) and things like buttons for navigation and alerts on welcome can be a real put off to your website, as it comes across on a non-personal level.
    I'm trying to do something similar to dzone dot com.

    The goal is when the scrollbar reaches the bottom to populate more results.

    Thanks
    No trees were harmed in the transmission of this message.
    However, a rather large number of electrons were temporarily
    inconvenienced.

  • #5
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,302
    Thanks
    10
    Thanked 586 Times in 567 Posts
    the scrollbars don't have standard events, so there is no easy way to do this.

    you might try putting a clear span, abs positioned over the bottom portion of the select. give that span a 'onmouseover' event to do what you need it to. make sure that the span is only a couple pixels tall, else you might interfere with the select on ff/safari.

    you can figure the bottom by carefull setting of the style attributes. use "px" to set the font height, multiply byt size, and add border/padding widths.


  •  

    Posting Permissions

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