Coder Social home page Coder Social logo

angular-input-placeholders's Introduction

angular-input-placeholders

Animates input placeholders to make it look like they are being typed in realtime. angular-input-placeholders

Dependencies

Install

Bower

$ bower install angular-input-placeholders

Then simply just include the JavaScript file in your document!

Usage

To use this Angular module, add wb.inputPholders as a dependency in your Angular module.

angular.module('yourApp', [..., 'wb.inputPholders']);

To actually use it;

<input input-pholders="Your first placeholder!|Your second placeholder.|And so on..">

or

<input data-input-pholders="Your first placeholder!|Your second placeholder.|And so on..">

Of course, you can add any other attribute to the input elements as you would do normally.

Configuration

The default config values are;

  • waitBeforeDeleteMs - 2000 ms

The amount of milliseconds to wait before starting to delete the placeholder (the amount of time the placeholder is fully readable).

  • waitInBetweenMs - 300 ms

    Amount of milliseconds to wait before starting to print the next placeholder.

  • writeSpeedMs - 100 ms

    The absolute slowest speed to wait between printing characters (characters are printed at random intervals that span from 0 ms to whatever this config value is set to).

  • deleteSpeedMs - 60 ms

    Same as writeSpeedMs (see above), but for when deleting characters.

####There are 2 ways of changing these config values.

You can change these configuration values either specifically for just one element, or across the whole application.

To change these values for just one element, you can do like this;

<input type="text"
  input-pholders="Lorem Ipsum.."
  input-pholders-wait-before-deleting="1000"
  input-pholders-wait-in-between="50"
  input-pholders-write-speed="30"
  input-pholders-delete-speed="10" />

To change the default config values permanently, you can utilize the inputPholdersProvider in an Angular config-block, like so;

angular.module('yourApp',  [..., 'wb.inputPholders'])
  // Immediately after registering your Angular module, change the config values.
  .config(function (inputPholdersProvider) {
    inputPholdersProvider.config.waitBeforeDeleteMs = 1000;
    inputPholdersProvider.config.waitInBetweenMs = 500;
    inputPholdersProvider.config.writeSpeedMs = 120;
    inputPholdersProvider.config.deleteSpeedMs = 80;
  });

License

Licensed under the MIT license.

Authors

William Boman [email protected]

angular-input-placeholders's People

Contributors

williamboman avatar

Watchers

 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.