Jquery draggable with zoom problem

后端 未结 5 1239
面向向阳花
面向向阳花 2020-12-05 11:21

I am working on a page in witch all its contents are scaled by using zoom. The problem is that when I drag something in the page the dragging item gets a bad position that s

5条回答
  •  孤城傲影
    2020-12-05 12:05

    Are you taking the scroll position, margin and padding into account? Such as:

    x.left + 
    parseInt($(this).css('margin-left')) + 
    parseInt($(this).css('padding-left')) + 
    parseInt($(this).parent().scrollLeft());
    
    x.top + 
    parseInt($(this).css('margin-top')) + 
    parseInt($(this).css('padding-top')) + 
    parseInt($(this).parent().scrollTop());
    

    Then adjusting for the zoom value as needed?

提交回复
热议问题