【问题标题】:When I make a draggable clone how to retain the height and width of the element当我制作可拖动克隆时如何保留元素的高度和宽度
【发布时间】:2016-05-09 23:57:20
【问题描述】:
$("li", $taskList).draggable({
    helper : "clone",
    revert : "invalid"
});

在拖动元素时,我希望保持相同的高度和宽度。

【问题讨论】:

  • 相同的偏移量是什么意思?
  • 拖动前的div偏移量

标签: javascript jquery html drag-and-drop angular-ui-bootstrap


【解决方案1】:

只是建立在 Prasad 的回答之上 - 保持原始项目的宽度和高度:

$(el).draggable({
  helper: 'clone',
  start: function (event, ui) {
    var w = $(this).css('width');
    var h = $(this).css('height');
    ui.helper.css('width', w).css('height', h);
  }
});

(编辑增加高度)

【讨论】:

    【解决方案2】:
    $("li", $taskList).draggable({
        helper: 'clone',
        start: function (e, ui) {
            ui.helper.animate({
                width: 80,
                height: 50
            });
        }
    });
    

    这对我有用。拖动时我们可以设置曲线的高度和宽度。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-09-26
      • 2013-06-07
      • 1970-01-01
      • 2021-04-03
      • 1970-01-01
      • 2014-06-07
      • 1970-01-01
      相关资源
      最近更新 更多