Reputation: 1606
I am trying to use datePicker in a div. I would like expand the height of the div as the datePicker calendar opens..
I have a div like that:
.dateBox{
width:160px;
height:auto;
border:1px solid blue;
}
The problem is as you click on datePicker input and open calendar, .datebox height doesn't change.. I have been playing around but I couldn't figure it out...
How can I fix that?
Live: http://jsfiddle.net/fcrsznb1/2/
Thanx in advance!
Upvotes: 5
Views: 73033
Reputation: 160
Note: the information bellow is for Air Datepicker plugin (http://t1m0n.name/air-datepicker/docs/index.html)
If you want several datepickers with different styles, you can use classes
option.
Set your class name as a value on particular datepicker initialisation:
$("#myInput").datepicker({
...
classes: "my-datepcker-class",
...
});
This will render a datepicker with the main block like this:
<div class="datepickers-container" id="datepickers-container">
<div class="datepicker my-datepcker-class ..." >
....
So you can override any inner style of this datepicker instance
.my-datepcker-class .datepicker--content {
/* CSS styles here */
}
Upvotes: 0
Reputation: 103
Right click on datepicker
box. Select 'inspect' (Ctrl+Shift+I) in Chrome or 'inspect element' (Q) in Firefox. Find the CSS style that you want to change.
Example:
.ui-datepicker {
font-size: 5%;
}
.ui-widget-header {
background: #77CC6D;
}
.ui-widget-content .ui-state-default:hover{
background: #77CC6D;
border-radius: 2px;
}
To change the date format, change the script:
$(document).ready(function() {
$("#datepicker").datepicker({ dateFormat: 'D, d-M-yy' });
});
D > Day
d > date
M > short Month (Jan)
MM > long Month (January)
m > month number (1)
mm > month double number (01)
y > year (17)
yy > year (2017)
Upvotes: 1
Reputation: 642
Custom CSS for the date picker:
Copy this into your CSS file. check this result black and green datepicker
/* datepicker css */
.ui-datepicker {
background: #000000; /* Old browsers */
background: #000000 -moz-linear-gradient(top, #fcfcfc 0%, #fff 100%); /* FF3.6+ */
background: #000000 -webkit-gradient(linear, left top, left bottom, color-
stop(0%,#000000)), color-stop(100%,#34495e); /* Chrome,Safari4+ */
background: #000000 -webkit-linear-gradient(top,#000000 0%, #34495e 100%); /*
Chrome10+,Safari5.1+ */
background: #000000 -o-linear-gradient(top,#000000 0%, #34495e 100%); /* Opera11.10+
*/
background: #000000 -ms-linear-gradient(top,#000000 0%, #34495e 100%); /* IE10+ */
background: #000000 linear-gradient(top,#000000 0%, #34495e 100%); /* W3C */
font-size:11px;
padding:10px;
border:1px solid #5BFEC8;
width: 300px;
}
.ui-datepicker table td {
text-align:center;
}
.ui-datepicker a {
cursor:pointer;
text-decoration:none;
}
.ui-datepicker-prev {
}
.ui-datepicker-next {
float:right;
}
.ui-datepicker-title {
text-align: center;
font-weight:bold;
}
.ui-widget.ui-widget-content{
border: 2px solid #5BFEC8;
}
.ui-datepicker th {
padding: .7em .3em;
text-align: center;
font-weight: bold;
border: 0;
color: #5BFEC8;
}
.ui-state-default,
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default{
border: 1px solid #5bfec8;
background: #000000;
font-weight: normal;
color: #5bfec8;
}
a.ui-state-default:hover{
border: 1px solid white;
background: #5bfec8;
font-weight: bold;
color: black;
}
.ui-state-active, .ui-widget-content .ui-state-active,
.ui-widget-header .ui-state-active {
border: 1px solid white;
background: #5bfec8;
font-weight: bold;
color: black;
}
.ui-state-highlight,
.ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {
border: 1px solid #dad55e;
background: #fffa90;
color: black;
}
.ui-widget-header {
border: 1px solid #5bfec8;
background: #080808;
color: #5bfec8;
font-weight: bold;
}
Upvotes: 0
Reputation: 131
.ui-datepicker {
width: 300px;
height: 300px;
margin: 5px auto 0;
font: 12pt Arial, sans-serif;
/*-webkit-box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, .5);
-moz-box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, .5);*/
}
.ui-datepicker table {
width: 100%;
}
.ui-datepicker-header {
background: #3399ff;
color: #ffffff;
font-family:'Times New Roman';
border-width: 1px 0 0 0;
border-style: solid;
border-color: #111;
}
.ui-datepicker-title {
text-align: center;
font-size: 15px;
}
.ui-datepicker-prev {
float: left;
cursor: pointer;
background-position: center -30px;
}
.ui-datepicker-next {
float: right;
cursor: pointer;
background-position: center 0px;
}
.ui-datepicker thead {
background-color: #f7f7f7;
/*border-bottom: 1px solid #bbb;*/
}
.ui-datepicker th {
background-color:#808080;
text-transform: uppercase;
font-size: 8pt;
color: #666666;
/*text-shadow: 1px 0px 0px #fff;*/
/*filter: dropshadow(color=#fff, offx=1, offy=0);*/
}
.ui-datepicker tbody td {
padding: 0;
/*border-right: 1px solid #808080;*/
}
.ui-datepicker tbody td:last-child {
border-right: 0px;
}
.ui-datepicker tbody tr {
border-bottom: 1px solid #bbb;
}
.ui-datepicker tbody tr:last-child {
border-bottom: 0px;
}
.ui-datepicker a {
text-decoration: none;
}
.ui-datepicker td span, .ui-datepicker td a {
display: inline-block;
/*font-weight: bold;*/
text-align: center;
width: 30px;
height: 30px;
line-height: 30px;
color: #ffffff;
/*text-shadow: 1px 1px 0px #fff;*/
/*filter: dropshadow(color=#fff, offx=1, offy=1);*/
}
.ui-datepicker-calendar .ui-state-default {
background: linear-gradient(#999999, #737373);
color:#ffffff;
height:40px;
width:40px;
}
.ui-datepicker-calendar .ui-state-hover {
background: #33adff;
color: #FFFFFF;
}
.ui-datepicker-calendar .ui-state-active {
background: #33adff;
-webkit-box-shadow: inset 0px 0px 10px 0px rgba(0, 0, 0, .1);
-moz-box-shadow: inset 0px 0px 10px 0px rgba(0, 0, 0, .1);
box-shadow: inset 0px 0px 10px 0px rgba(0, 0, 0, .1);
color: #e0e0e0;
text-shadow: 0px 1px 0px #4d7a85;
border: 1px solid #55838f;
position: relative;
margin: -1px;
}
.ui-datepicker-unselectable .ui-state-default {
background: #D6E4BE;
color: #000;
}
Upvotes: 13
Reputation: 1381
You will need to reference the datepicker classes themselves and change their styles.
Instead of using this
.dateBox{
width:160px;
height:auto;
border:1px solid blue;
}
Change the name to this and see if that is what you were looking for
.ui-widget-content{
width:160px;
height:auto;
border:1px solid blue;
}
Upvotes: 0
Reputation: 68
If you are looking to animate the datebox you can try using:
$( "#datepicker1" ).datepicker({ showAnim: "fold" })
You can use any of the effects listed here: http://api.jqueryui.com/category/effects/
Here's a jsfiddle showing you it working: http://jsfiddle.net/fcrsznb1/3/
If you are looking to do other things you might want to check out the docs.
http://api.jqueryui.com/datepicker/ See if any options will do what you are looking for.
Upvotes: 4