SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Scrolling a layer with a scrollbar ...

    Does anyone know of an example of or can point me in the direction of a JavaScript that will allow you to scroll a layer with the scrollbars instead of with an onMouseDown() command on a graphic. I'd like to try and make scrolling layers more accessible and the only major reason they fail is because you can't use them with a mouse as they're independent of the OS.

    Any ideas?

    G

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No javascript needed here

    div {
    overflow: auto; // Just like a window
    overflow: scroll; // Forces scrollbars, even if content is smaller than container
    }

    Take your pick.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So, (and I'm sorry but I haven't played with this yet) with this I can have a layer with a defined clip area, in the centre of the page, and the normal IE (for arguments sake) scrollbar will control its scrolling ... ?

    If so, that's very cool!

  4. #4
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice. Two things. Neither work in NN4 (which I don't really care about!) and my clip rectangles get screwed up in Netscape 6. Dammit! Still, works a treat in IE!

  5. #5
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by greg.harvey
    ...my clip rectangles get screwed up in Netscape 6.
    They shouldn't do, though some browsers are very finicky about commas and spacing in the compound attributes.

    Be sure to include units, commas and spaces.

    e.g... clip: rect(10px, 5px, 10px, 5px)

    I use clipping regions extensively in my own folio site (lots of dhtml) and even alter the clipping region of some divs on the fly by using the DOM (W3C).
    It works fine in IE5+ and Mozilla, but not in Opera (thanks to its incomplete DOM support).

    Given that my site works fine in Moz, I don't see why clipping attributes would be acting up in NN6 (unless it's due to one of its many bugs).

    Have you tried your page/code in Mozilla?
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  6. #6
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. It's commas. I did it the lazy way, and quickly made the page in Dreamweaver. Amazingly enough, Dreamweaver DOESN'T put commas in the clip rectangle coordinates! D'oh!

    Edit:

    Rats! Seems it wasn't that. Here's my code:

    Code:
    position:absolute; left:175px; top:100px; width:400px; height:250px; z-index:1; overflow: auto; clip: rect(0px, 400px, 250px, 0px)
    Can't understand it! It should be fine but Netscape 6 refuses to get the clip rectangle right. And this is a really simple test page with one layer in it!


    G
    Last edited by greg.harvey; Oct 4, 2002 at 03:41.

  7. #7
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ps

    Just tried it in Mozi and it's fine. It is a Netscape 6 bug.

    G


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
  •