GithubHelp home page GithubHelp logo

mwaura69 / caleandar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jackducasse/caleandar

0.0 0.0 0.0 16 KB

A lightweight, library independent JavaScript calendar

License: MIT License

JavaScript 65.68% CSS 32.00% HTML 2.32%

caleandar's Introduction

######v0.0.1 #Caleandar Let me keep the intro brief. It's a lightweight (about 7.5kb minified at the time of writing) and library-independent calendar script with optional themes. You can add events to the calendar and add functionality on click of the event. That's about the jist of it. Continue reading for instructions on how to use and examples.

###Installing Simply download the caleandar.js file and any of the css themes you'd like. Then include a reference to the file(s) in your html:

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

plus any of the following optional css files

<link rel="stylesheet" href="css/theme1.css"/>
<link rel="stylesheet" href="css/theme2.css"/>
<link rel="stylesheet" href="css/theme3.css"/>

###Instantiating At it's simplest, call the calendar() function with the following 3 optional parametars:

caleandar(element, events, settings);

Where element is an HTML element, events is an array of event objects and settings is an object of settings. Pretty straightforward so far.

####Element A single HTML element. ######Examples: var element = caleandar(document.querySelector('#foo'));

var element = caleandar(document.getElementById('foo'));

var element = caleandar(document.getElementsByClassName('bar')[0]);

or if you are using jQuery: var element = caleandar($('#foo'));

####Events An array of event objects to be placed on their respective dates on the calendar. ######Examples: Using Simple links for events:

var events = [
  {'Date': new Date(2016, 6, 1), 'Title': 'Doctor appointment at 3:25pm.'},
  {'Date': new Date(2016, 6, 7), 'Title': 'New Garfield movie comes out!', 'Link': 'https://garfield.com'},
  {'Date': new Date(2016, 6, 11), 'Title': '25 year anniversary', 'Link': 'https://www.google.com.au/#q=anniversary+gifts'},
];

Using anonymous functions to instantiate on click:

var events = [
  {'Date': new Date(2016, 6, 1), 'Title': 'Doctor appointment at 3:25pm.', 'Link': function(){console.log('Reminder!');}},
  {'Date': new Date(2016, 6, 7), 'Title': 'New Garfield movie comes out!', 'Link': function(){alert("Better not miss the movie!");}},
  {'Date': new Date(2016, 6, 11), 'Title': '25 year anniversary', 'Link': function(){console.debug(document.getElementById('foo'));}},
];

####Settings Below are all the possible settings attributes with example values.

var settings={
    Color: '#999',                //(string - color) font color of whole calendar.
    LinkColor: '#333',            //(string - color) font color of event titles.
    NavShow: true,                //(bool) show navigation arrows.
    NavVertical: false,           //(bool) show previous and coming months.
    NavLocation: '#foo',          //(string - element) where to display navigation, if not in default position.
    DateTimeShow: true,           //(bool) show current date.
    DateTimeFormat: 'mmm, yyyy',  //(string - dateformat) format previously mentioned date is shown in.
    DatetimeLocation: '',         //(string - element) where to display previously mentioned date, if not in default position.
    EventClick: '',               //(function) a function that should instantiate on the click of any event. parameters passed in via data link attribute.
    EventTargetWholeDay: false,   //(bool) clicking on the whole date will trigger event action, as opposed to just clicking on the title.
    DisabledDays: [],             //(array of numbers) days of the week to be slightly transparent. ie: [1,6] to fade Sunday and Saturday.
    ModelChange: model            //(array of objects) new data object to pass into calendar (serving suggestion: passing through only the currently selected month's events if working with large dataset.
  }

###CSS Themes #####Theme 1

<link rel="stylesheet" href="css/theme1.css"/>

theme1.css

#####Theme 2

<link rel="stylesheet" href="css/theme2.css"/>

theme2.css

#####Theme 3

<link rel="stylesheet" href="css/theme3.css"/>

theme3.css

caleandar's People

Contributors

jackducasse 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.