in partnership with mediatemple

Ticket #371 (reopened defect)

Opened 10 months ago

Last modified 2 days ago

Fx.Scroll. max scroll impossible if there is border or scrollLine.

Reported by: magmoro@… Owned by:
Type: defect Priority: minor
Milestone: Mootools version 1.3 Component: Plugins
Keywords: Fx.Scroll Cc:

Description

It's imposible full scroll with Fx.Scroll . Here example (strict mode):
http://theocp.info/studio/moro/Fx.Scroll/scroll.html
If u even set x or y very big u get not full scroll.
It because u use offsetWidth and offsetHeight (el.size[z]) when calculate max:

var el = this.element.getSize();

var values = {'x': x, 'y': y};
for (var z in el.size){

var max = el.scrollSize[z] - el.size[z];
...

U shoud use clienWidth and clientHeight.
Fix:
var el = this.element.getSize();

el.size={

x : this.element.clientWidth,
y : this.element.clientHeight

}
var values = {'x': x, 'y': y};
for (var z in el.size){

var max = el.scrollSize[z] - el.size[z];

Here fixed example:
http://theocp.info/studio/moro/Fx.Scroll/scrollFix.html
Tested in FF2 IE6 Opera 9.
Note: still there is some issue in Opera if padding!=0.

Change History

Changed 8 months ago by kamicane

  • status changed from new to closed
  • resolution set to wontfix

clientWidth/clientHeight are not crossbrowser element properties.

Changed 8 months ago by magmoro@…

  • status changed from closed to reopened
  • resolution deleted

why not crossbrowser? http://www.quirksmode.org/js/elementdimensions.html

scrollSize is size of content and paddings

clientSize is size of visible content and paddings

offsetSize is size of visible content and paddings + scrollBar + border

must be scrollSize-clientSize, not scrollSize-offsetSize.

scrollSize-offsetSize<scrollSize-clientSize.

scrollSize-offsetSize not max if there is border or scrollBar.

Changed 8 months ago by kamicane

  • status changed from reopened to closed
  • resolution set to wontfix

I remember trying clientWidth/Height in ie6, and it gave me problems. Do you have a (working) test page?

Changed 8 months ago by magmoro@…

  • status changed from closed to reopened
  • resolution deleted

what type of problems? no problems for me.

http://www.xp-computers.ru/moro/scroll.html

Changed 8 months ago by kamicane

  • status changed from reopened to closed
  • resolution set to fixed

fixed in [998]

Changed 6 months ago by magmoro@…

  • status changed from closed to reopened
  • resolution deleted
  • component set to Plugins

fix is broken. Fx.Scroll now use offsetSize not a clientSize

Changed 2 months ago by kamicane

for posterity, clientWidth and clientHeight only work in explorer when the element has a layout (hasLayout)

A possible fix is to add this layout by adding the zoom style to ie.

Another possible fix is reading the border values to manually calculate the client dimensions, but that would only work if borders are set in pixels.

Changed 2 days ago by tomocchino

  • priority changed from major to minor
  • milestone changed from Mootools version 1.2 to Mootools version 1.3
Note: See TracTickets for help on using tickets.