gwtquery
gwtquery copied to clipboard
GQUERY Animated scrollPanel onLeft
Hi, i use this instruction to slide an HorizontalScrollPanel scrollPanel.getHorizontalScrollbar().setHorizontalScrollPosition(scrollPanel.getHorizontalScrollbar().getHorizontalScrollPosition()-200);
I'd like to animate this slide with GQWERY but:
GQuery scrollPanelElem = jquerySelector.getScrollPanel(); scrollPanelElem.animate("opacity:'0'", 500); //it works GWT.log("int "+scrollPanelElem.scrollLeft()); //it doesn't work scrollPanelElem.scrollLeft(200); //it doesn't work, return always 0 scrollPanelElem.animate("scrollLeft: '200'",500, EasingCurve.swing); //it doesn't work
What happens if you set at the beginning of you program FX.css3 = false ?
On Fri, Jul 18, 2014 at 2:08 PM, paulux84 [email protected] wrote:
Hi, i use this instruction to slide an HorizontalScrollPanel
scrollPanel.getHorizontalScrollbar().setHorizontalScrollPosition(scrollPanel.getHorizontalScrollbar().getHorizontalScrollPosition()-200);
I'd like to animate this slide with GQWERY but:
GQuery scrollPanelElem = jquerySelector.getScrollPanel(); scrollPanelElem.animate("opacity:'0'", 500); //it works GWT.log("int "+scrollPanelElem.scrollLeft()); //it doesn't work scrollPanelElem.scrollLeft(200); //it doesn't work, return always 0 scrollPanelElem.animate("scrollLeft: '200'",500, EasingCurve.swing); //it doesn't work
— Reply to this email directly or view it on GitHub https://github.com/gwtquery/gwtquery/issues/295.
Absolutely nothing! scrollPanelElem.scrollLeft() return always '0' and scollPanelElem no scroll on left
Could you tell me on which browsers you get the problem ? What is your GWT version ?
Browser: Chrome Versione 36.0.1985.125 GWT: 2.6.1
out of curiosity: Do you have the same problem on firefox ?
On Mon, Jul 21, 2014 at 11:21 AM, paulux84 [email protected] wrote:
Browser: Chrome Versione 36.0.1985.125 GWT: 2.6.1
— Reply to this email directly or view it on GitHub https://github.com/gwtquery/gwtquery/issues/295#issuecomment-49585798.
In fact, I bet your problem is linked to this issue in GWT: https://gwt-review.googlesource.com/#/c/7764/
This issue is fixed and the fix will be available in GWT 2.7. You could test with the nightly build of gwt in order to ensure that it works fine with the last version of GWT
Also on Firefox, this code:
GQuery scrollPanelElem = jquerySelector.getScrollPanel(); Window.alert("int "+scrollPanelElem.scrollLeft());
return '0' in a window alert.
Have you any others solutions or workaround?
In fcat the animation of a property doesn't seem to work anymore. Please find below the code I've written to animate the scrollTop of an element.
public class ScrollTopAnimation extends Animation {
private Element element;
private int start;
private ScrollTopAnimation(Element element) {
this.element = element;
}
@Override
protected void onStart() {
start = element.getScrollTop();
super.onStart();
}
@Override
protected void onUpdate(double progress) {
double value = start - start * progress;
element.setScrollTop((int) value);
}
@Override
protected double interpolate(double progress) {
return EasingCurve.easeInOut.interpolate(progress);
}
}
and I use it like this:
new ScrollTopAnimation(element).run(400);
You have to modify the line:
double value = start - start * progress;
to achieve what you want (for my part the goal of this animation was to set the scrollTop to 0)