问题
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
What is happened after
popupbeforeposition
to make the top value changed?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