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 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Safari issue with coordinates and scrollTo

    I've set up a small function that uses moveTo to center a position in the browser window:

    Code:
    function centerScroll(xx,yy){
    var xpos
    var ypos
    
    xpos = xx - document.body.clientWidth/2
    ypos = yy - document.body.clientHeight/2
    
    scrollTo(xpos, ypos)
    }
    This function is accessed from a link:

    Code:
    <a href="javascript:centerScroll(1462, 1725);">Go!</a>
    Those coordinates are about center of a very large document nearly 3000px X 3000px in size.

    I've tested the code in Explorer and Firefox in Windows XP and OS X and it works perfectly. When I've tested in Safari, however, it moves to the x-coordinate without a problem, but it doesn't move to the y-coordinate properly. It hits at about 500 or 600 pixels down from the top of the browser, but not the full 1725. Oddly enough, when I put in the coordinates (1462, 3000) it hits the right mark just fine.

    So I have two questions:

    1.) Is there a better way to do this that will work on all browsers?
    2.) If there isn't, how do Safari coordinates work? I could use a browser detect function that takes in coordinates and fixes them to work on the user's browser, but I'd need to know a general rule for converting coordinates.

    I appreciate any help on this.

    To see the script in action, go to http://www.appfilmfest.org/draft and click "How To Submit".

  • #2
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I can't see the code. I've e-mailed the admins on this but they are ignoring my complaint.

  • #3
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by joemacman
    I can't see the code. I've e-mailed the admins on this but they are ignoring my complaint.
    That's what happens when you use a MAC when you should be using a PC...
    And I doubt the admins have been ignoring you, especially with as many posts on the board as you have... But, this is an issue of the way vBulletin displays CODE and PHP tags in a division in such a way that some MAC/BROWSER combinations can not support and thus is out of their hands...

    Besides, if all your message to the admins said is what you said here "I can't see the code"
    They probably did not, could not understand what you meant...

    .....Willy


  •  

    Posting Permissions

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