Forum Moderators: not2easy
I would like the mouse wheel and PgUp/PgDn to scroll the div box under the cursor, but currently they are just ignored (I am guessing the browser interprets them as scrolling the whole page, which has nothing to scroll). Is these some "proper" way of solving this?
Thanks a lot!
Other that a lot of complex event capture scripting, this is not something you can easily do.
I would not worry about it. The browser will scroll the div (or frame) if the focus is on that object. In the case of a div, I believe that if the mouse is over the div, the scroll wheel will scroll the div.
I would always recommend allowing the browser to behave in the way it wants to from a usability standpoint.
I would like the mouse wheel and PgUp/PgDn to scroll the div box under the cursor, but currently they are just ignored (I am guessing the browser interprets them as scrolling the whole page, which has nothing to scroll). Is these some "proper" way of solving this?
The behavior you are looking for is only supported on the following browsers: IE 5.5 Windows, IE 6 Windows (with some problems with jerky scrolling in some cases), Firebird 0.7 for windows (but not 0.8).
Opera 6 has no support for overflow:auto;
Opera 7 supports it partially, but you have to do manual scrolling, in other words, you have to put your mouse on the div scroll bar and move it, a totally unacceptable option for user friendliness in my opinion.
Same with Safari, IE 5x mac, IE 4-5.0x, along with all other mozillas I've seen.
A supposed fix has been posted here [webmasterworld.com] and an update to that here [webmasterworld.com] but as you can see it's not simple, and only works for a single scrolling element. Those fixes are also not completely stable, I've gotten reports of complete failure on IE 6 but haven't been able to duplicate the error.
If you want iframe functionality, and you don't need the contents spidered (see this thread [webmasterworld.com] for problems with iframes) use iframes, there is currently no substitute for their full functionality.
[edited by: isitreal at 4:41 pm (utc) on April 20, 2004]
I honestly don't recall if that is why I used a span (as opposed to a div). There are other DIVs on the same page, so I am guessing it might be the reason.
Sticky me if you want the URL.
This is why it's working, you were lucky that you did this for only IE, since IE is the only browser that supports that method. However, you might have trouble with IE mac unless you are testing for that as well.
You can duplicate this result with CSS by this:
* html #overflow-container1 {
overflow:auto;
}
this should make it overflow only on IE, I can't remember if that also applies to IE mac or not. In other words, the above would make #overflow-container1 have overflow:auto only for ie browsers, otherwise it would have no special overflow behavior.
I know that I had difficulty with the overall layout trying to get it to work on Netscape (4.x was still pretty popular at that time). I thought it had to do with something else, but this may have been part of it too. With the huge differences between 4.x and 6.0 at the time (and 6.0 was VERY buggy), I simply gave up.
Sorry about the red herring!
At the least you want to first test for Opera in the navigator user agent string first, then MSIE if not mac.
Anyway, it wasn't really a red herring, I've tested these methods extensively in vain hope of finding an actual replacement for iframes but none of them work quite right, I was just curious about using the span tag.