I have a webcontainer within another webcontainer, and I’d like the child container to scroll within the parent container. I have the following code in the mousedown event of a label control, and it It seems like it should work to scroll the child container:
Shouldn’t that scroll the child container 300 pixels up within the parent container? Although the mousedown event fires and the scrollto line appears to run, the scrollto command appears to do nothing. It doesn’t trigger the contentscrolled event of the parent container as I think it should. Any ideas as to what I am doing wrong?
Another general question about scrollto … if it does work, is it an animated scroll?
First things first. The method scrolls TO a position, not by the amounts you supply, so the x and y values have a minimum of 0. I’m not in front of my computer, but it may be that it ignores values < 0.
As far as animation, that’s up to the individual browsers, so the best answer I can give you is “maybe”. Keep in mind that if it does work today, it may not in the next release of that particular browser.
I wonder what the rationale would be for having a minimum value of 0. You can set the top of the child container to less than 0, so why not be able to scrollto a number less than 0? I have tried scrollto with positive numbers and I haven’t been able to get that work either. But if the animation isn’t reliable, then maybe it’s better just to use top instead of scrollto.
Ah, I think I get it now. I had a conceptually wrong idea of what scrollto does. It doesn’t move the container itself, but moves the contents of the container. I’ve been trying to use scrollto on the child container, when I should have been using it on the parent container.