-
-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use jQuery UI Position for positioning the Datepicker #41
Comments
Is this still supposed to work? I would like to position the datepicker below the input box but using the following doesn't work. Have I missed something.
Thanks |
this post was about a suggestion that zebra datepicker to use jQuery UI for positioning $('.datepicker').Zebra_DatePicker({
default_position: 'below'
}); |
Thanks for your reply. Apologies I misinterpreted the post. I tried default_position but that moves the datepicker relative to the cursor when what I am looking for is relative to the input. default_position: 'below' looks like this: I would like it to look like the image below which is taken from an old site that used a version of the datepicker from 2012. Can that be done. Thanks |
i just pushed version 2.0.0 of the datepicker. with that you can do this $('.datepicker').Zebra_DatePicker({
onOpen: function() {
var properties = this.data('Zebra_DatePicker'),
$datepicker = properties.datepicker,
$parent = $(this),
parent_position = $parent.offset(),
parent_height = $parent.outerHeight();
$datepicker.css({
left: parent_position.left,
top: parent_position.top + parent_height + 5
});
}
});
I will look into adding more default positionings options though |
Yes, that worked, exactly what I needed. Thanks for your prompt response. |
Use jQuery UI's Position class for positioning the Datepicker relative to the Textfield. This is more flexible. You could even choose another element to position against.
This also saves a lot (!) of positioning logic in the
zebra_datepicker.js
Demo: https://jqueryui.com/position/
API Docs: http://api.jqueryui.com/position/
So, the setting:
will translate to:
And this setting:
will translate to:
The text was updated successfully, but these errors were encountered: