Webkit and jQuery draggable jumping

后端 未结 8 1095
误落风尘
误落风尘 2020-11-28 23:40

As an experiment, I created a few div\'s and rotated them using CSS3.

    .items { 
        position: absolute;
        cursor: pointer;
        background:          


        
8条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-29 00:33

    I prefer this workaround as it preserves the original handler
    It removes the transform then restores it

    $(document).ready(function(){
    
        // backup original handler
        var _mouseStart = $.ui.draggable.prototype._mouseStart;
    
        $.ui.draggable.prototype._mouseStart = function(event) {
    
            //remove the transform
            var transform = this.element.css('transform');
            this.element.css('transform', 'none');
    
            // call original handler
            var result = _mouseStart.call(this, event);
    
            //restore the transform
            this.element.css('transform', transform);
    
            return result;
        };
    });
    

    demo (started from @Liao San-Kai jsbin)

提交回复
热议问题