SitePoint Sponsor

User Tag List

Results 1 to 14 of 14

Thread: Scroll Body !IE

  1. #1
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Scroll Body !IE

    My site works at 1024x768 as a whole page; or 800x600 with two rectangles of 800x600 interlinked, one starting at (0,0) the other at (210,120). I've put a button at (210,120) which, when clicked I want the page to scroll to when the screens at (800,600), showing the second rectangle in the screen.
    With IE this works
    Code:
    onclick="if(ie){document.documentElement.scrollTop=130;document.documentElement.scrollLeft=210}"
    but I can't find the NS or Moz equivalent.

    Any suggestions?
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ::: certified wild guess :::

  3. #3
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    superb Thanks....
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  4. #4
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    sorry, after translating to a scroll move function I discovered those functions were what I was trying, and
    pageXOffset and pageYOffset are read only in NS and Mozilla
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  5. #5
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Doh!
    Found it
    window.scrollTo(x,y)
    supported in IE,NS,Mozilla but !Opera.....That'll do....
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  6. #6
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yeah, scrollTo(x,y) works in almost all browsers & it also works in Opera7 I think.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  7. #7
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    So it does, musta been doing something wrong before..... probably tryinng it in a large window!!!!
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  8. #8
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I think that scrollTop() is a bit primitive or is supported in IE only. I've never used it though, always used scrollTo(). Its quite easy & not messy.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  9. #9
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    scrollTop is a integer property - not a function. Both global scroll functions - window.scrollTo(), window.scrollBy() - are JS 1.2, and supported everywhere, afaik.
    ::: certified wild guess :::

  10. #10
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I have used scrollTop for objects since day1, it works in all of my browsers.....
    (not for body element though)

    But what I like about IE over !IE is IE allows the scrolling of an object even if the scrollbars are hidden (css overflow:hidden). Without changing it to a clipped division, can I get rid of the scrollbars in !IE and still scroll?

    Any idea if it will be included in future !IE browsers?

    Its the easiest way to make dynamic menus/text, and contents are still visible when JS is off.
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  11. #11
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You get many great features in IE but not in other browsers.
    That's why its the most used browsers & as far as I've seen, people prefer
    it for their intranets too, b'coz it can have a lots of functionality & their intranet
    websites can be designed specifically for IE & hence pack lot of power.

    Yeah, you can hide the scrollbar in IE. Just place
    scroll="NO" in the body tag.
    It'll hide the scrollbars. But I don't know if you can scroll after hiding
    scrollbars. Never tried it though.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  12. #12
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    also in css

    body { overflow:hidden }

    and IE still scrolls, but I'd like to know if other browsers will support it in the future? My site in any other browser has loads of scrollbars ( which can't even be colored ) but luckily I found a colour scheme that I think works. It would be better if they wern't there though.

    also, rather than using scroll="no" in body or overflow:hidden in css it's better to set in JS, this way the object are still scrollable when js is off.
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  13. #13
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Read this to see why MSIE's behavior in this regard is (gasp!) non-standard.

    So, per the spec, you either: 1) allow scrolling, which means scrollbars, or 2) you don't allow scrolling, which means no scrollbars.

    To emulate MSIE's nonstandard behaviour, you've got two options: 1) Get rid of the divs and use iframes, or 2) use dynamic positioning and clipping, as you mentioned, in them !IE things.
    ::: certified wild guess :::

  14. #14
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Also, the scroll=no property of the <body> tag works only in IE.
    Also I don't know whether the css way works in other browsers except IE.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!


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
  •