Reputation:
I'm tying to scroll to my category list but on iOS the command does't work. On Android it's ok..
Code example:
@ViewChild(Content) content: Content;
scrollTo() {
this.content.scrollTo(0, 100, 200);
}
-
<button ion-button (click)="scrollTo()">Down 100px</button>
On iOS it goes down 100px but return to top.
How can I fix this?
Thanks!
Upvotes: 2
Views: 868
Reputation: 714
Here's a code that'll help you
$("#clickme").click(function() {
$('html, body').animate({
scrollTop: $("#wrap2").offset().top
}, 2000);
return false;
});
$("#clickme2").click(function() {
$('html, body').animate({
scrollTop: $("#wrap").offset().top
}, 2000);
return false;
});
And below the related html
<div id="wrap">
<a href="" id="clickme">Click Me</a>
</div>
<div id="wrap2">
<a href="" id="clickme2">Go to top</a>
</div>
You should adapt the above JQuery to your situation. Remember at the end of the day, it's all about JAVASCRIPT
Upvotes: 2