小编Are*_*rek的帖子

jQuery UI调整自定义句柄的大小,而不是调整大小元素的子元素

我需要为jQuery UI可调整大小的元素提供自定义句柄,这些元素不是此元素的子元素.我尝试按照它在jQuery UI文档页面上记录的方式进行操作,但是我无法让它工作并且我的想法用完了.

这是我的示例设置(不工作):

HTML

<div id="wrapper">
  <div id="resize-me"></div>
</div>

<div class="ui-resizable-handle ui-resizable-n" id="n-resize-handle"></div>
<div class="ui-resizable-handle ui-resizable-e" id="e-resize-handle"></div>
<div class="ui-resizable-handle ui-resizable-s" id="s-resize-handle"></div>
<div class="ui-resizable-handle ui-resizable-w" id="w-resize-handle"></div>
<div class="ui-resizable-handle ui-resizable-ne" id="ne-resize-handle"></div>
<div class="ui-resizable-handle ui-resizable-se" id="se-resize-handle"></div>
<div class="ui-resizable-handle ui-resizable-sw" id="sw-resize-handle"></div>
<div class="ui-resizable-handle ui-resizable-nw" id="nw-resize-handle"></div>
Run Code Online (Sandbox Code Playgroud)

JS

$('#resize-me').resizable({
  handles: {
    n: $('#n-resize-handle'),
    e: $('#e-resize-handle'),
    s: $('#s-resize-handle'),
    w: $('#w-resize-handle'),
    ne: $('#ne-resize-handle'),
    se: $('#se-resize-handle'),
    sw: $('#sw-resize-handle'),
    nw: $('#nw-resize-handle')
  }
});
Run Code Online (Sandbox Code Playgroud)

我在codepen.io上准备了这个问题的演示

我在网上搜索了如何实现类似的例子.也许有人这样做了,可以指出我错过了什么?

我已经看到了这个问题,但我认为这不是重复的,因为对于生产代码来说,答案是不可行的,正如答案的作者所说的那样.

任何帮助将不胜感激.

jquery jquery-ui

10
推荐指数
1
解决办法
2090
查看次数

使用Uint8ClampedArray的Node.js画布实现

对于任何画布专业人士 - 我需要帮助.

我正在使用node-canvas而我正在尝试imageData使用它的getImageData方法.不幸的是它返回:

interface ImageData {
    readonly attribute unsigned long width;
    readonly attribute unsigned long height;
    readonly attribute CanvasPixelArray data;
}
Run Code Online (Sandbox Code Playgroud)

CanvasPixelArray不赞成使用Uint8ClampedArray.

我的问题是:

有没有一种方式getImageData返回Uint8ClampedArray或转换CanvasPixelArrayUint8ClampedArray

如果不是这样,也许有人可以指点我在节点中的其他一些画布实现?

非常感谢任何帮助,谢谢你提前!

javascript canvas node.js node-canvas

6
推荐指数
1
解决办法
555
查看次数

如何在D3折线图中添加轴和线之间的空间?

鉴于我创建的这个简单图表:

 var data  = [["2013-01-24 06:38:02.235191", 52], ["2013-01-23 06:38:02.235310", 54], ["2013-01-22 06:38:02.235330", 45], ["2013-01-21 06:38:02.235346", 53]],
  maxValue = d3.max(data, function (d) { return d[1]; }),
  margin   = {top: 20, right: 20, bottom: 50, left: 50},
  width    = 500 - margin.left - margin.right,
  height   = 300 - margin.top - margin.bottom,
  svg, x, y, xAxis, yAxis, line;

$.each(data, function(index, val) {
    val[0] = new Date(val[0]);
  });

x = d3.time.scale()
  .range([0, width])

y = d3.scale.linear()
  .domain([0, maxValue])
  .range([height, 0]);

xAxis = d3.svg.axis()
  .scale(x) …
Run Code Online (Sandbox Code Playgroud)

d3.js

1
推荐指数
1
解决办法
6259
查看次数

标签 统计

canvas ×1

d3.js ×1

javascript ×1

jquery ×1

jquery-ui ×1

node-canvas ×1

node.js ×1