fix positioning, when go to next month or year

This commit is contained in:
t1m0n 2015-12-03 10:34:11 +03:00
parent 3ebadcf08b
commit 249bc9db9b
5 changed files with 34 additions and 16 deletions

View File

@ -599,6 +599,9 @@ var Datepicker;
if (this.inited && !this.silent) {
this.views[this.view]._render();
this.nav._render();
if (this.visible && this.elIsInput) {
this.setPosition();
}
}
return val;
@ -632,7 +635,7 @@ var Datepicker;
if (this.opts.onChangeView) {
this.opts.onChangeView(val)
}
this.setPosition(this.opts.position)
if (this.elIsInput && this.visible) this.setPosition();
}
return val

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,4 @@
<!DOCTYPE html><html><head><title>Air Datepicker</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link href="css/style.css" rel="stylesheet" type="text/css"><link href="css/github-gist.css" rel="stylesheet" type="text/css"><link href="../dist/css/datepicker.min.css" rel="stylesheet" type="text/css"><link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,300,500&amp;subset=latin,cyrillic" rel="stylesheet" type="text/css"><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script><script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.9.1/highlight.min.js"></script><script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script><script src="../dist/js/datepicker.js"></script><script src="../dist/js/i18n/datepicker.en.js"></script></head><body><div class="wrapper"><main role="main" class="main"><div class="container"><div class="buttons"><a aria-label="Star t1m0n/air-datepicker on GitHub" data-count-aria-label="# stargazers on GitHub" data-count-api="/repos/t1m0n/air-datepicker#stargazers_count" data-count-href="/t1m0n/air-datepicker/stargazers" data-icon="octicon-star" href="https://github.com/t1m0n/air-datepicker" class="github-button">Star</a></div><a href="index.html" class="lang-link"><img src="img/en.png"><span>In English</span></a><h1 class="promo-header">AIR DATEPICKER<span>легкий кроссбраузерный jQuery календарь</span></h1><p class="-text-center-"><div class="datepicker-here datepicker-promo"></div><script>var $promo = $('.datepicker-promo');
$promo.datepicker()
</script></p><article><h2 id="intro">Описание</h2><p>Легкий (<strong>~20kb</strong> минифицированный js файл и <strong>~5.5kb</strong> gziped) кроссбраузерный календарь, написан с использованием<span class="example-inline"><code>es5</code></span>и<span class="example-inline"><code class="js">css flexbox</code></span>. Работает во всех современных браузерах:
<strong>IE 10+</strong>, <strong>Chrome</strong>, <strong>Firefox</strong>, <strong>Safari 8+</strong>, <strong>Opera 17+</strong>.</p></article><article><h2 id="install">Установка</h2><pre class="example-code"><code class="html">bower i --save air-datepicker</code></pre><p>Либо можно скачать файлы напрямую с <a href="https://github.com/t1m0n/air-datepicker/tree/master/dist">GitHub</a></p></article><article><h2 id="usage">Использование</h2><p>Подключите стили и скрипты из папки<span class="example-inline"><code>/dist</code></span>:</p><pre class="example-code"><code class="html">&lt;html&gt;
&lt;head&gt;
@ -13,8 +10,16 @@ $('#my-element').datepicker([options])
// Доступ к экземпляру объекта
$('#my-element').data('datepicker')
</code></pre></article><article><h2 id="examples">Примеры</h2><h3>Инициализация с опциями по умолчанию</h3><div class="example"><div class="example--label">Пример</div><div class="example-content"><input type="text" class="datepicker-here"></div><pre class="example-code"><code class="html">&lt;input type='text' class='datepicker-here' /&gt;
</code></pre></div><h3>Выбор нескольких дат</h3><p>Передайте параметр<span class="example-inline"><code class="js">{multipleDates: true}</code></span>для выбора нескольких дат. Если требуется ограничить количество выбранных дат, то передайте необходимое число<span class="example-inline"><code class="js">{multipleDates: 3}</code></span>.</p><div class="example"><div class="example--label">Пример</div><div class="example-content"><input type="text" data-multiple-dates="3" data-multiple-dates-separator=", " data-position="top left" class="datepicker-here"></div><pre class="example-code"><code class="html">&lt;input type=&quot;text&quot;
</code></pre></article><article><h2 id="examples">Примеры</h2><h3>Инициализация с опциями по умолчанию</h3><div class="example"><div class="example--label">Пример</div><div class="example-content"><input type="text" id="test" class="datepicker-here"></div><pre class="example-code"><code class="html">&lt;input type='text' class='datepicker-here' /&gt;
</code></pre><script>$('#test').datepicker({
onChangeYear: function () {
console.log(arguments);
},
onChangeMonth: function (m, y) {
console.log(arguments);
}
})
</script></div><h3>Выбор нескольких дат</h3><p>Передайте параметр<span class="example-inline"><code class="js">{multipleDates: true}</code></span>для выбора нескольких дат. Если требуется ограничить количество выбранных дат, то передайте необходимое число<span class="example-inline"><code class="js">{multipleDates: 3}</code></span>.</p><div class="example"><div class="example--label">Пример</div><div class="example-content"><input type="text" data-multiple-dates="3" data-multiple-dates-separator=", " data-position="top left" class="datepicker-here"></div><pre class="example-code"><code class="html">&lt;input type=&quot;text&quot;
class=&quot;datepicker-here&quot;
data-multiple-dates=&quot;3&quot;
data-multiple-dates-separator=&quot;, &quot;

View File

@ -14,17 +14,14 @@ block content
script.
var $promo = $('.datepicker-promo');
$promo.datepicker()
article
h2#intro Описание
p
|Легкий (<strong>~20kb</strong> минифицированный js файл и <strong>~5.5kb</strong> gziped) кроссбраузерный календарь, написан с использованием
| Легкий (<strong>~20kb</strong> минифицированный js файл и <strong>~5.5kb</strong> gziped) кроссбраузерный календарь, написан с использованием
+example-inline('es5')
| и
+example-inline('css flexbox', 'js')
|. Работает во всех современных браузерах:
| . Работает во всех современных браузерах:
| <strong>IE 10+</strong>, <strong>Chrome</strong>, <strong>Firefox</strong>, <strong>Safari 8+</strong>, <strong>Opera 17+</strong>.
article
@ -35,7 +32,7 @@ block content
article
h2#usage Использование
p
|Подключите стили и скрипты из папки
| Подключите стили и скрипты из папки
+example-inline('/dist')
| :
@ -69,11 +66,21 @@ block content
h3 Инициализация с опциями по умолчанию
+example
+example-content
input(type='text').datepicker-here
input(type='text')#test.datepicker-here
+example-code('html')
:code
<input type='text' class='datepicker-here' />
script.
$('#test').datepicker({
onChangeYear: function () {
console.log(arguments);
},
onChangeMonth: function (m, y) {
console.log(arguments);
}
})
h3 Выбор нескольких дат
p
| Передайте параметр
@ -432,7 +439,7 @@ block content
+param-header('monthsField','string','"monthsShort"')
p Какое поле из объекта локализации использовать в качестве названий месяцев, когда
+example-inline('view = "months"', 'js')
|.
| .
article
h2#events События

View File

@ -599,6 +599,9 @@ var Datepicker;
if (this.inited && !this.silent) {
this.views[this.view]._render();
this.nav._render();
if (this.visible && this.elIsInput) {
this.setPosition();
}
}
return val;
@ -632,7 +635,7 @@ var Datepicker;
if (this.opts.onChangeView) {
this.opts.onChangeView(val)
}
this.setPosition(this.opts.position)
if (this.elIsInput && this.visible) this.setPosition();
}
return val