Coder Social home page Coder Social logo

sandbox's People

Contributors

bseth99 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sandbox's Issues

How to use this in Wordpress?

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.

How to Change values for Inline CSS?

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.

some confused about the text in the ui-slider-label-ticks chidren span

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 );
}

licensing conditions of your code

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.

previous months are not showing

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.