Why the top value of popup dialog is changed after popupbeforeposition event

不想你离开。 提交于 2019-12-25 11:54:56

问题


I want my popup dialog to show at the top of the screen at each time, so, i add the logic in JS as follows.

$( "#dress_length_size_chart_popup" ).on({
    popupbeforeposition: function () {
        var f = document.getElementById('dress_length_size_chart_popup-popup');
        f.style.top = ** +'px';
    }
});

Unfortunately, it doesn't work. Although, the top is set in the callback function of popupbeforeposition, the value will be changed again, and my settings are overridden. (what happened here??)

If I move the logic to other callback function of popupafteropen. It will work.

However, when I scroll the page, only popupbeforeposition but not popupafteropen will be called. So, the top setting is still lost.

So, the questions are

  1. What is happened after popupbeforeposition to make the top value changed?

  2. How I can catch the event to make my top setting work?

thanks!

来源:https://stackoverflow.com/questions/34806351/why-the-top-value-of-popup-dialog-is-changed-after-popupbeforeposition-event

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!