【发布时间】:2015-03-27 15:12:33
【问题描述】:
我正在努力检测 N 轴是向上还是向下移动?而且我希望里面的物体(h2和p)保持在原位。有人可以帮忙吗!
http://jsfiddle.net/zerolfc/y62awe4u/2/
<div class="ss-zone-object" style="top: 68px; width:300px; height: 500px; left: 20px;">
<h2 style="top: 100px; width: 60px;">Title</h2>
<p style="left: 122px; top: 120px; width: 60px;">Summary</p>
</div>
$(function () {
$('.ss-zone-object').resizable({
grid: [1, 1],
handles: 'n,s',
resize: function (e, ui) {
var handle_axis = $(this).data('ui-resizable').axis;
$(this).find('h2, p').each(function (mk, mv) {
var obj_top = parseInt($(this).position().top);
if (handle_axis === 'n') { // Axis N, moving down then minus one
$(this).css('top', (obj_top - 1) + 'px');
} else if (handle_axis === 's') {
}
});
},
stop: function (e, ui) {}
});
});
【问题讨论】:
-
“Jquery UI sortable 检测上下轴” ?,
$('.ss-zone-object').resizable({? -
api.jqueryui.com/resizable 阅读此内容可能会有所帮助..
-
您的问题能否更具体一点? N轴是什么?你的意思是当你滚动时div里面的对象需要保持固定?
标签: javascript jquery jquery-ui resizable