Ngdraggable with Ionic framework drag and drop coordinates issue

I am using ngdraggable with ionic framework for dragging and dropping divs containing images.

I have a header and subheader defined on my page, while I drag divs, coordinates are not perfectly points to location where I am dragging div, It is dragging below the dragging point. It is adding header and subheader heights while dragging and dropping divs.

Is there any way to resolve this issue?

1 Like

the ion-content is positionated absolute -> add the top-position of the ion-content to your calculated y-coords.

Thanks. Issue is resolved by changing ngDraggable

_ty = _my - element.centerY - $window.pageYOffset;
_ty = _my - element.centerY - $window.pageYOffset - 88;

on line 162.

Yeah but manipulating libs directly in their soures is not a really good idea. BTW the 88px are different on android and ios.

Maybe you can change your content in your ion-content to get this work (but a div node with positition-relative in the dom) or something else?