stefangabos / Zebra_Datepicker

A super-lightweight, highly configurable, cross-browser date time picker jQuery plugin
https://stefangabos.github.io/Zebra_Datepicker/
Other
399 stars 183 forks source link

Zebra_DatePicker instance doesn't add container on .update() #166

Closed betheymc closed 4 years ago

betheymc commented 4 years ago

When I try to add a container to a datepicker instance on .update(), the datepicker is still not added into the container, but on the $('body') element.

Here's basically what I did:

var el = $('input#datepicker');
var inst = el.data('Zebra_DatePicker');
$('<div class="zebra-datepicker-div"></div>').insertAfter(el);

// set the position of the container
el.siblings('.zebra-datepicker-div').first().css({'width': '300px', 'height': '300px', 'top': '1217px', 'left': '803.5px'});

// update datepicker to be in container
inst.update({container: $(el).siblings('.zebra-datepicker-div').first()});
stefangabos commented 4 years ago

that's not something i thought about - i always felt like the container should be known upfront so updating the container does nothing. but fair point i am now looking into it

stefangabos commented 4 years ago

should be fixed, please have a look

stefangabos commented 4 years ago

have you had the chance to test this?

betheymc commented 4 years ago

@stefangabos sorry I haven't got back with you yet, been super busy at work. I found a workaround, so haven't yet had a chance to test. I will plan to do that in the near future and let you know how it goes.

stefangabos commented 4 years ago

ok, thanks!

betheymc commented 3 years ago

@stefangabos Just tested this, and it works! I think anyone updating the container should be sure to position the datepicker correctly so that it will actually visually go inside the container, but the datepicker html definitely shows up inside the container now on update. Thank you!