JQ小部件移动窗口时获取位置

时间:2013-10-02 18:42:25

标签: javascript jquery

当我打开这样一个窗口的位置时,我得到了这个位置:

$('#windowAdConsole').on('open', function(event) {

    $('#windowAdConsole').jqxWindow('bringToFront');

    xPosPrev = xPosNew;
    yPosPrev = yPosNew;

//我在这里获得职位

        $('#windowAdConsole').jqxWindow({ position: { x: xPosPrev + 20, y: yPosPrev + 20} });
    position = $('#windowAdConsole').jqxWindow('position');
    xPosNew = position.x;
    yPosNew = position.y;


});

但是当我移动并释放位置时,我不会让位置移动,但是当它被打开时,它不会被移动。例如,窗口的正面位置是x:200 y:200,然后我移动了它,我又得到了相同的值。 用于移动它的代码是:

    $('#windowAdConsole').on('moved', function (event) {
    position = $('#windowAdConsole').jqxWindow('position');
    xPosNew = position.x;
    yPosNew = position.y;
});

如何获得窗口的新移动位置?

1 个答案:

答案 0 :(得分:0)

这应该做的工作:

$('#windowAdConsole').on('moved', function (event)
{
  $("#showevent").html("You  moved the window " + ', X: ' + event.args.x + ', Y: ' + event.args.y);
});

....
<div id="showevent"></div>
相关问题