Giter Club home page Giter Club logo

faded's Introduction

FADED

A standalone JavaScript plug-in for visually hinted lists. Yep, zero dependencies.

Demo

Have a look. โ˜๏ธ DEMO ๐Ÿ”ฆ

Installation

Add ./dist/faded.min.js to your project.

Usage

Built with a UMD (Universal Module Definition) pattern.

Plain JavaScript

Insert script into your HTML.

<script type="text/javascript" src="./path/to/faded.min.js"></script>

Faded constructor is then attached to browser window global.

window.Faded("list_to_faded");

CommonJS

var Faded = require("./path/to/faded.min.js");

RequireJS

define('module/id/string', ["./path/to/faded.min.js"],
function(Faded){
  // Faded Usage
});

API

Faded(element[, opts])

element

Type: <String>|<HTMLElement>

Description: Reference to HTML DOM node

Restriction:

  • Only ONE HTMLElement node reference permitted
  • NO tree traversal (looks for element with all specified class's)

Ex:

// HTMLElement ID
Faded("#listID");

// HTMLElement class
Faded(".list_class_name.active");

// HTMLElement reference
var node = document.getElementById("listID");
Faded(node);

opts

Type: <Object>

Description: The selected element children style configuration

Ex:

var opts = {};
Faded("listID", opts);

opts.range

Type: <Number>

Default: 0.6

Ex:

var opts = {
  range: 0.6
};
Faded("listID", opts);

opts.style

Type: <AllStyle>

Default: {opacity: {min: 0.1, max: 1}}

Ex:

var opts = {
  color: {
    min: "rgba(12, 66, 144, 0.2)",
    max: "#FFF"
  }
};
Faded("listID", opts);

Type Definition

@typedef <Object> AllStyle
@prop <Style> 

@typedef <Object> Style
@property <Number|String> max
@property <Number|String> min

// Data Structure
{
  CSS_Property: {
    min: <Number|Color>,
    max: <Number|Color>
  }
}

AllStyle

Type: <Object>

Description: <AllStyle> is a collection <Style> definitions where each KEY represents a valid CSS property to modify on the <element>'s children.

Restriction:

  • KEY MUST reference a valid CSS style property
  • KEY REQUIRED as camelcase or hyphen separated words ('backgroundColor', 'border-color')

Ex:

var opts = {
  style: {
    color: {/*<Style>*/},
    backgroundColor: {/*<Style>*/},
    'border-radius': {/*<Style>*/}
  }
};

Style

Type: <Object>

Description: Configures the corresponding CSS property (KEY) to which it's assigned.

Restriction:

  • One or more declared properties
  • Single simple data type property - ONLY <Number|String>
  • (min,max) value should be selected CSS appropriate

Note: Use <String> to specify a color value. Accepts (hex, rgb, rgba).

Ex:

var opts = {
  style: {
    opacity: {
      min: 0.1,
    },
    color: {
      min: 'rgba(0,0,0,0.3)',
      max: 'black'
    },
    backgroundColor: {
      min: '#222',
      max: 'rgb(255,255,255)'
    }
  }
};

Style.min

Type: Number|String

Description: Edge styling for selected list.

Style.max

Type: <Number>|<String>

Description: Center styling for selected list

Contribution

faded's People

Contributors

frankymartz avatar thoughtpalette avatar

Stargazers

 avatar Mark Steve Samson avatar Eduardo Villuendas avatar Paul Schaefer avatar Alex Carpenter avatar Eric Cheung avatar Leonardo Faria avatar  avatar  avatar Kenneth Ormandy avatar Ding Yi avatar Edmundo Santos avatar Nathan Peters avatar Giovanni Galbiati avatar David M. avatar Rogerio Marques avatar

Watchers

Matt Mesker avatar Jack Eisenberg avatar Uri Ratner avatar James Cloos avatar Michael McMillan avatar David Potter avatar

faded's Issues

Create jQuery wrapper

Would like to be able to do something like this:

$('.my-list').fog({options});

on projects that already have jQuery.

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.