Ion-scroll always display image at the top by default and scrollTo is not working


#1

Hi,Im using Ionic and try to use ion-scroll to view pictures(need zoom and scroll), now I meet a problem
By default in ion-scroll, the image is always displayed on the top of the scroll area, but what I want is display the image at the center of ion-scroll area, then I try to use scrollTo but it’s not working in this case.
Here is code pen:


In controller, scroll to is not working

$ionicScrollDelegate.$getByHandle('small').scrollTo(0,-10,true);//direction y <0, not working
$ionicScrollDelegate.$getByHandle('small').scrollBy(30,50,true);//direction y >0, not working

( direction x is OK, direction y is not ,so the image still stay at the top of the page.)
Does any one ( :smile: @mhartington) can help me to resolve this ? or other solution/suggestion? Many thanks and please forgive my pool English~


#2

Holy scroll-view batman!

I think the problems are coming from the ion-scroll inside the ion-slide-box


#3

@mhartington Not really, I removed slide-box, issue still there, I think the point is that the height of Image less then the height of scroll area,you can’t force the size of the image always large than the scroll area.
I don’t know how to resolve this problem, any suggestion?


#4

any help? many thanks