Giter VIP home page Giter VIP logo

placeload.js's Introduction

placeload.js

NPM version

The best way to create a placeholder layout effect.

What is it?

Placeload.js is a library to customize your interface previews/skeleton screen that yield a fantastic user experience.

Getting started

Compiled and production-ready code can be found in the dist directory. The lib directory contains development code.

Install placeload.js with npm:

$ npm install placeload.js

Install placeload.js with bower:

$ bower install https://github.com/victorvoid/placeload.js.git

1. Include placeload on your site.

<script src="dist/placeload.min.js"></script>

2. Paint your placeholder

import Placeload from 'placeload.js'

Placeload
  .$('.user-placeload')
  .config({speed: '2s'})
  .line((element) => element.width(300).height(200))
  .fold(
    (err) => console.log('error: ', err),
    (allElements) => console.log('allElements: ', allElements)
  )

3. Placeload uses lazy evaluation, in that nothing is evaluated until necessary.

import Placeload from 'placeload.js'

const userLoader = Placeload
  .$('.user-placeload')
  .config({speed: '2s'})
  .line((element) => element.width(300).height(200))
  .config({spaceBetween: '30px'})
  .line((element) => element.width(400).height(20))
  .config({spaceBetween: '30px'})
  .line((element) => element.width(400).height(20))
  .config({spaceBetween: '30px'})
  .line((element) => element.width(250).height(20))

//running
userLoader.fold(
  err => console.log('error: ', err),
  allElements => console.log('allElements: ', allElements)
)

//Removing when data are loaded
API.getUsers()
  .then(users => {
    userLoader.remove()
  })

Placeload 0.0.1 (OLD API) ๐Ÿ™ˆ

Read the reference documentation for this version here

$ npm install [email protected]
  var placeUserUI = new Placeload('.user-placeload');
  placeUserUI.draw({
    width: '300px',
    height: '200px'
  });

  placeUserUI.draw({
    width: '400px',
    height: '20px',
    marginTop: '10px'
  });

  placeUserUI.draw({
    width: '400px',
    height: '20px',
    marginTop: '10px'
  });

  placeUserUI.draw({
    width: '250px',
    height: '20px',
    marginTop: '10px'
  });

Authors

The repo is written and maintained by Victor Igor. Other contributors that have submitted something, in alphabetical order:

License

The code is available under the MIT License.

placeload.js's People

Contributors

rv-vmartins avatar victorvoid 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

placeload.js's Issues

Ionic, Angular usage

I am having a hard time implementing this in my ionic app, anybody had worked implemented this on angular 4 with ionic
Please help.

Stays always visible and don't mask the content

I'm not sure what I'm doing wrong. I add placeload and use the code from the example, trying to integrate it in my wordpress site. Placeholder always stays visible above the content, don't mask anything and never disappear.

Documentation is out-of-date

Various aspects of documentation seem to be out-of-date.

Most frustrating of all, the sample code doesn't work.

A jsfiddle or codepen would be helpful.

it can not work properly

it can not work properly as i want a two-column effect as below. the configuration(border-radius) does not take effect.

2017-02-21 10 22 51

Import not working

I'm importing with webpack and these both ways are not working:

import Placeload from 'placeload.js'

const userLoader = Placeload
  .$('.user-placeload')
import Placeload from 'placeload.js'

const userLoader = new Placeload('.user-placeload')

I tried to print Placeload to console and it's importing an empty object

Reload the placeload

Nice library!!! If I have a 'Refresh Data' button on my page how can the placeload be shown when the button is clicked. Is a function similar to remove() that loads the placeload elements?

Installation Guide

Hello victorvoid am still finding it hard to use the place load can you explain it better am totally confused......

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.