Hello guys,
It’s been a long time since I last visited this forum. I have an issue regarding the ionic scroll delegate. I wrote a simple directive that scrolls to a dom element whenever the user clicks on it . Here is my directive
myapp.directive('scrolltop',
[
'$ionicScrollDelegate',
function(
$ionicScrollDelegate
) {
return {
link: function (scope, element, attrs) {
element.on('click', function (event) {
// - (element.height() +13) + 70
// Also testes scrollBy
$ionicScrollDelegate.scrollTo(0, element.offset().top, true);
});
}
};
}
]
);
So, a very simple directive. But this code scrolls way too much below when the item is clicked. Also, if applied on a text input, the cursor is still blinking even though the input is not displayed (… as it has scrolled too much and the dome element is not even visible). What is the correct way to do that ?
Not sure if you guys understand but it would be very nice to have a scrollToElement on the $ionicScrollDelegate object.
Hakan.