小编pau*_*lth的帖子

jQuery使用CSS转换比例拖动/调整大小

我正在应用CSS转换(以及特定于浏览器的-webkit,-o等):

transform:matrix(0.5,0,0,0.5,0,0);

到div然后使用jQuery的draggable()和resizable()插件对所述div的孩子.

我遇到的问题是,在拖动或调整子元素大小时,jQuery所做的更改与鼠标"同步"的因子等于应用的比例.

我在stackoverflow上找到了一个解决方案(虽然我愚蠢地没有将它加入书签但现在无法找到它......)建议修补插件,并且它运行得非常好.它沿着这条线走:

function monkeyPatch_mouseStart() {
  // don't really need this, but in case I did, I could store it and chain
  // var oldFn = $.ui.draggable.prototype._mouseStart ;
  $.ui.draggable.prototype._mouseStart = function(event) {

    var o = this.options;

    //Create and append the visible helper
    this.helper = this._createHelper(event);

    //Cache the helper size
    this._cacheHelperProportions();

    //If ddmanager is used for droppables, set the global draggable
    if($.ui.ddmanager)
      $.ui.ddmanager.current = this;

    /*
     * - Position generation -
     * This block generates everything position related - …
Run Code Online (Sandbox Code Playgroud)

javascript css jquery jquery-ui css-transforms

48
推荐指数
1
解决办法
3万
查看次数

使用DELETE请求发送正文的干净方法是什么?

我需要使用$ resource发送一个带有DELETE请求的请求体

我能看到这样做的唯一方法就是改变:

https://github.com/angular/angular.js/blob/master/src/ngResource/resource.js

var hasBody = action.method == 'POST' || action.method == 'PUT' || action.method == 'PATCH';
Run Code Online (Sandbox Code Playgroud)

var hasBody = action.method == 'POST' || action.method == 'PUT' || action.method == 'PATCH' || action.method == 'DELETE';
Run Code Online (Sandbox Code Playgroud)

有没有更好的方法来覆盖这个?就像改变内容类型标题一样,您可以这样做:

$httpProvider.defaults.headers["delete"] = {'Content-Type': 'application/json;charset=utf-8'};
Run Code Online (Sandbox Code Playgroud)

或类似的东西......我用谷歌搜索了这个,但也许我错过了一些明显的东西(不是第一次).在此先感谢您的帮助.

javascript angularjs angular-resource

23
推荐指数
1
解决办法
3万
查看次数