Giter Club home page Giter Club logo

socal's Introduction

socal: A simple date picker plugin.

Socal is a fully functional datepicker with a simple setup and robust functionality. It is intended specifically for use in applications where dates need to be selected. It is not meant to operate as a full fledged calendar widget... yet!

Initial Setup

Include the socal.min.js script in the head of your html:

<script type="text/javascript" src="socal.min.js"></script>

Initialize SoCal with an element on your page. This requires some element for SoCal to bind to, and the initialization script itself.:

<body>
  <div id="calendar"></div>
</body>

<script type="text/javascript">
  function main() {
  var soCal = new SoCal();
  soCal
    .bindTo('#calendar'); //An id tag is best here.
  }
  document.addEventListener('DOMContentLoaded', main);
</script>

Calling the .bindTo() method is what will initialize the date picker, so all other methods used to setup functionality should be declared before the bindTo() call.

Out of the box, SoCal is set up without interaction. In order to activate its functionality you have a couple options:

.enableDateSelection()

This is the most basic interaction behavior. This allows dates to be selected.

.enableDateRangeSelection()

This allows for date ranges to be selected. Date selection is also set by default when this is enabled.

.onDateChange(callback) and .onDateRangeChange(callback)

If you wish to do something once a date has been selected, use this to attach a callback to the event. The difference between which to use is contingent on what type of functionality you are trying to achieve.

socal's People

Contributors

threesided avatar

Stargazers

Arthur Thornton avatar

Watchers

James Cloos avatar  avatar

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.