nazar-pc / PickMeUp

Really simple, powerful, customizable and lightweight standalone datepicker
BSD Zero Clause License
615 stars 191 forks source link

position #171

Closed iamxor closed 6 years ago

iamxor commented 7 years ago

Used in div with 'display:flex;flex-flow:column;' and position of calendar popup were incorrect. Modified dom_offset function with thus:

var x = y = 0;
if (element.offsetParent) {
    do {
        x += element.offsetLeft;
        y += element.offsetTop;
    } while (element = element.offsetParent);
}
return {left : x, top : y};

and voila...

mb usefull 4 smbdy

nazar-pc commented 7 years ago

You shouldn't need to modify anything in library itself. Could you share a demo where this happens?

iamxor commented 7 years ago

latest Firefox browser

http://rgho.st/6KsKJPMrW

https://pastebin.com/Lpq5UjcX

nazar-pc commented 7 years ago

Could you instead modify suggested live demo?: https://jsfiddle.net/qx152r6r/ It is much easier to have a complete example to test with and confirm that issue is fixed afterwards.

iamxor commented 7 years ago

mb like thus can't reproduce more clearly cos here in DNN huge bunch of scripts u can see that position shifts... https://jsfiddle.net/qx152r6r/174/

nazar-pc commented 7 years ago

In fact, it has nothing to do with display: flex, but rather with body{position: relative}: https://jsfiddle.net/qx152r6r/175/

Will think about what I can do with it.

nazar-pc commented 6 years ago

I've just published 3.1.0 that supports custom function in position option, so now it is possible to implement arbitrary positioning in generic way.