bseth99 / sandbox Goto Github PK
View Code? Open in Web Editor NEWThis is the source for my GitHub pages.
Home Page: bseth99.github.com
This is the source for my GitHub pages.
Home Page: bseth99.github.com
I've try this
(function($) {
$.datepicker._defaults.onAfterUpdate = null;
var datepicker__updateDatepicker = $.datepicker._updateDatepicker;
$.datepicker._updateDatepicker = function( inst ) {
datepicker__updateDatepicker.call( this, inst );
var onAfterUpdate = this._get(inst, 'onAfterUpdate');
if (onAfterUpdate)
onAfterUpdate.apply((inst.input ? inst.input[0] : null),
[(inst.input ? inst.input.val() : ''), inst]);
}
var cur = -1, prv = -1;
$('#jrange div')
.datepicker({
//numberOfMonths: 3,
changeMonth: true,
changeYear: true,
showButtonPanel: true,
beforeShowDay: function ( date ) {
return [true, ( (date.getTime() >= Math.min(prv, cur) && date.getTime() <= Math.max(prv, cur)) ? 'date-range-selected' : '')];
},
onSelect: function ( dateText, inst ) {
var d1, d2;
prv = cur;
cur = (new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay)).getTime();
if ( prv == -1 || prv == cur ) {
prv = cur;
$('#jrange input').val( dateText );
} else {
d1 = $.datepicker.formatDate( 'mm/dd/yy', new Date(Math.min(prv,cur)), {} );
d2 = $.datepicker.formatDate( 'mm/dd/yy', new Date(Math.max(prv,cur)), {} );
$('#jrange input').val( d1+' - '+d2 );
}
},
onChangeMonthYear: function ( year, month, inst ) {
//prv = cur = -1;
},
onAfterUpdate: function ( inst ) {
$('<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">Done</button>')
.appendTo($('#jrange div .ui-datepicker-buttonpane'))
.on('click', function () { $('#jrange div').hide(); });
}
})
.position({
my: 'left top',
at: 'left bottom',
of: $('#jrange input')
})
.hide();
$('#jrange input').on('focus', function (e) {
var v = this.value,
d;
try {
if ( v.indexOf(' - ') > -1 ) {
d = v.split(' - ');
prv = $.datepicker.parseDate( 'mm/dd/yy', d[0] ).getTime();
cur = $.datepicker.parseDate( 'mm/dd/yy', d[1] ).getTime();
} else if ( v.length > 0 ) {
prv = cur = $.datepicker.parseDate( 'mm/dd/yy', v ).getTime();
}
} catch ( e ) {
cur = prv = -1;
}
if ( cur > -1 )
$('#jrange div').datepicker('setDate', new Date(cur));
$('#jrange div').datepicker('refresh').show();
});
})(jQuery);
But this doesn't work.
After applying the function I noticed its adding css inline styles to the container.
<div class="ui-slider-wrapper ui-widget horizontal" style="font-size: 12px; width: 100px;">
....
</div>
Where does those inline css comes from? and how do i control/change them? I am now using !important
for now.
for some reason I have readed your code of the labeledslider ,and confused about the marker number
the fact my code is:
min:1,
max: 12
tickLabels: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
but it generate the marker default is
'2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月,12
so if I want to generate
'1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'
I have to set
min:0,
max: 11
accoridng to the code below, I think: change the code
labels[i*inr+min] ? labels[i*inr+min] : i*inr+min
to
labels[i*inr] ? labels[i*inr] : i*inr
is that correct?
bellow is the function of _drawLabels
for (;i<=cnt;i++) {
$('<div>').addClass( 'ui-slider-label-ticks' )
.css( dir, (Math.round( i / cnt * 10000 ) / 100) + '%' )
.html( '<span>'+( labels[i*inr+min] ? labels[i*inr+min] : i*inr+min)+'</span>').appendTo( $lbl );
}
I just found some useful code here and on your blog. In order to use it in a project I'm working on I need to know your licensing conditions.
I found this very useful for me, in your example there are only one calendar, so what i did I'm showing 12 months which looks good. issue is if I select the range from 29 march to 2 aprl it will select the dates.which is fine.
what if,i m trying to edit my dates I cant not see month of march, calendar will start from april.
is there any way whatever my dates are calendar should remain same from jan to dec.
(I'm using 12 months calendar, specially for mobile, in mobile view calendars are in shape of stack)
thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.