Modify the “options” parameter of popupbeforeposition event

匆匆过客 提交于 2019-12-01 10:38:02

beforeposition events omits an object containing values of popup's position (options), x, y and positionTo.

To modify those options once beforeposition triggers, use the below.

$( ".selector" ).on( "popupbeforeposition" , function (e, ui) {
    ui.x = value;
    ui.y = value;
    /* OR
    ui.positionTo = "window"
    */
});

If you wish to open a popup programmatically, use the below.

$( ".selector" ).popup( "open", {
  x: value,
  y: value
});

value = number in pixels

Demo

Here is a jsFiddle Demo: http://jsfiddle.net/ezanker/3pW3P/

I used the popupafteropen event instead and used the reposition method:

$("#page1").on("pageinit", function () {
    $("#popupPadded").on({
        popupafteropen: function () {
            $(this).popup("reposition", {
                x: 70,
                y: 115,
                positionTo: "window"
            });
        }
    });
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!