Ads

Friday, 29 August 2014

Rome : Customizable Date & Time Picker

Download   Demo


Customizable date (and time) picker. Opt-in UI, no jQuery!.Rome synchronizes in real-time with inputs, never steals focus, and its CSS is entirely customizable!


Oh, rome synchronizes in real-time with inputs, never steals focus, and its CSS is entirely customizable!


Rome depends on moment. It doesn’t depend on jQuery or other weird frameworks, though.


Install


From npm or Bower.


npm install --save rome

bower install --save rome

Note that if you’re using the standalone version, the API is published under the rome global. If you’re using CJS, then you’ll have to require('rome').


Setup


You can use your own distribution of moment, using rome.standalone.js.



<script src='moment.js'></script>
<script src='rome.standalone.js'></script>


You could just use the bundled rome.js distribution, which comes with moment in it.



<script src='rome.js'></script>


If you need to do anything regarding internationalization, refer to moment for that. Ideally, make those changes before starting to create Rome calendar components.



Rome : Customizable Date & Time Picker

Meny - A three dimensional and space effecient menu

Download   Demo


Meny is a three dimensional and space effecient menu. Meny works best in browsers with support for CSS 3D transforms, although it falls back on 2D animation for older browsers. Supports touch events for mobile devices.


1. INCLUDE JS FILES


<script src="js/meny.js"></script>

2. HTML


Meny requires two HTML elements to work: a menu and the page contents. The class names are not used by the library so chose anything you want.



<body>
<div class="meny">
<!-- your menu items -->
</div>
<div class="contents">
<!-- your page contents -->
</div>
</body>


Some rules, notes and best practices to keep in mind in terms of markup and styling:


  • The menu and contents should have the same parent element.

  • The background which appears behind the contents when Meny is open is not added by the library. You need to set your desired background to the parent element. The default style can be found in demo.css.

  • The arrow which appears when Meny is closed is also not added by the library, if you want it you can easily copy the styles from the demo.css.

  • The menu container will be automatically resized by the library according to configuration options.

  • Meny works on scrolling pages as the menu itself is fixed.

3. JAVASCRIPT


var meny = Meny.create(
// The element that will be animated in from off screen
menuElement: document.querySelector( '.meny' ),

// The contents that gets pushed aside while Meny is active
contentsElement: document.querySelector( '.contents' ),

// The alignment of the menu (top/right/bottom/left)
position: 'left',

// The height of the menu (when using top/bottom position)
height: 200,

// The width of the menu (when using left/right position)
width: 260,

// The angle at which the contents will rotate to.
angle: 30,

// The mouse distance from menu position which can trigger menu to open.
threshold: 40,

// Width(in px) of the thin line you see on screen when menu is in closed position.
overlap: 6,

// The total time taken by menu animation.
transitionDuration: '0.5s',

// Transition style for menu animations
transitionEasing: 'ease',

// Gradient overlay for the contents
gradient: 'rgba(0,0,0,0.20) 0%, rgba(0,0,0,0.65) 100%)',

// Use mouse movement to automatically open/close
mouse: true,

// Use touch swipe events to open/close
touch: true
);

4. API & EVENTS


A few handy methods API methods are included, you call these on the instance returned byMeny.create (see above).



meny.configure( mouse: false ); // change settings after initialization

meny.open();

meny.close();

meny.isOpen(); // true/false

meny.destroy(); // revert original DOM state, unbind events


The wrapper element (parent of the menu and contents) is decorated with classes based on its state:



.meny-active
.meny-top
.meny-right
.meny-bottom
.meny-left


Instances of Meny dispatch events to notify you of their state:



var meny = Meny.create( ... ) // see 3. Initialize

meny.addEventListener( 'open', function()

// do something on open

);

meny.addEventListener( 'close', function()

// do something on close

);

meny.addEventListener( 'opened', function()

// do something right after meny is opened and transitions finished

);

meny.addEventListener( 'closed', function()

// do something right after meny is closed and transitions finished

);



Meny - A three dimensional and space effecient menu

Sweep.js - Smoother color transitions

Download   Demo


Sweep.js is a small JavaScript library (5kb zipped) that enables proper color transitions through the HSL and HUSL spaces. Ordinary CSS transitions or existing frameworks like Velocity.js convert HSL colors to RGB beforetransitioning. sweep.js addresses this by letting you transition through the color spectrum.


1. INCLUDE JS FILES


<script src="path/to/sweep.js"></script>

2. HTML


<div id="ex1" class="example"><p>Click</p></div>

3. JAVASCRIPT


//click
var ex1 = document.querySelector('#ex1');
ex1.addEventListener('click', function()
sweep(ex1, 'backgroundColor', '#a8f', '#a8f', direction: -1, duration: 2000);
, false);

4. OPTIONS


Using sweep.js to transition an element’s color is easy. Whenever you want to trigger an HSL sweep, call:


sweep(target, properties, fromColor, toColor[, options])

  • target : element that you wish to animate

  • properties : CSS properties that you wish to animate (string or array of strings)

  • fromColor : initial color before the transition

  • toColor : final color after the transition

  • options (optional) : an object that can set the following:
    • callback : function to be called once the animation finishes

    • direction : clockwise (1) or counterclockwise (-1)

    • duration : time (in ms) to complete the animation

    • space : ‘HSL’, ‘HUSL’, or ‘RGB’



Sweep.js - Smoother color transitions

Thursday, 28 August 2014

jQuery Tbl Tree - Making hierarchical tree from HTML tables

Download   Demo


Demos



Tbl Tree is a jQuery plugin making hierarchical tree from HTML tables.


Features


  • Create Tree table from HTML table

  • Comparibaly fast on big tables

  • Ability to specify column to make a tree

  • Compatible with jquery-ui $.widget

  • Ability to save the state of the tree

  • Ability to expand/collapse by level of hierarchy

1. INCLUDE CSS AND JS FILES


<link type="text/css" href="css/jquery.tbltree.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="./js/jquery.tbltree.js"></script>

If you want to use saveState: option, then need to include $.coocke plugin as well:



<script type="text/javascript" src="./js/jquery.cookie.js"></script>


2. HTML


Create HTML Table by adding ‘row-id’ and ‘parent-id’ attributes to “tr” tags. Attributes names can be configured by options `rowAttr` and `parrentAttr`.



<table id="table1">
<tr>
<th>Title</th><th>Column 1</th><th>Column 2</th><th>Column 3</th>
</tr>
<tr row-id="1">
<td>Level 1</td><td class="data">2</td><td class="data">2</td><td class="data">2</td>
</tr>
<tr row-id="1.1" parent-id="1" >
<td>Level 1.1</td><td class="data">2</td><td class="data">2</td><td class="data">2</td>
</tr>
<tr row-id="2">
<td>Level 2</td><td class="data">2</td><td class="data">2</td><td class="data">2</td>
</tr>
<tr row-id="2.1" parent-id="2" >
<td>Level 2.1</td><td class="data">2</td><td class="data">2</td><td class="data">2</td>
</tr>
</table>

3. JAVASCRIPT


$(function() 
// initialize with default options
$( "#table1" ).tbltree();
);




jQuery Tbl Tree - Making hierarchical tree from HTML tables

Wednesday, 27 August 2014

Jeegoo - Flexible lightweight popup plugin

Download   Demo


Demos



1. INCLUDE CSS AND JS FILES


<link href="/jeegoopopup/skins/blue/style.css" rel="Stylesheet" type="text/css" />
<script type="text/javascript" src="/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="/jeegoopopup/jquery.jeegoopopup.1.0.0.min.js"></script>

2. HTML


<a href="dog.jpg" class="popup"><img src="dog.jpg" style="width:100px"/></a>

3. JAVASCRIPT


$(function()
$('a.popup').click(function(e)
$.jeegoopopup.open(
html: '<img src="' + $(this).attr('href') + '" />',
skinClass: 'jg_popup_basic',
resizable: false,
draggable: true,
fixed: false
);

$('#jg_popup_content').unbind('click.close').bind('click.close', function()
$.jeegoopopup.close();
);
return false;
);
);

  • Open a popup by calling

    $.jeegoopopup.open(options);

    where options is an object which can be configured with properties and callbacks.

  • Close a popup by calling

    $.jeegoopopup.close(arguments);

    Arguments passed to the close method are passed to the onClose callback of the topmost popup.

  • A (new) popup can be opened or closed from within (same domain) iframes by callingwindow.parent.$.jeegoopopup.open(options); or window.parent.$.jeegoopopup.close(arguments);


 



Jeegoo - Flexible lightweight popup plugin