Giter Site home page Giter Site logo

taxilian / angular-better-placeholders Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dmackerman/angular-better-placeholders

0.0 2.0 0.0 1.88 MB

Angular directive for enhanced placeholders that easily integrate with Bootstrap form fields.

Home Page: http://dmackerman.github.io/angular-better-placeholders/#/

angular-better-placeholders's Introduction

Stories in Ready

Angular Better Placeholders

An AngularJS directive to improve input placeholders. Based on a concept found on Dribble: http://dribbble.com/shots/1254439--GIF-Mobile-Form-Interaction?list=users

Dribble GIF

Check out the website

Installation

$ bower install angular-better-placeholders

Usage

Simple include the better-place-holder directive as a class on your input fields. (if it doesn't look right make sure that it's container element has position: relative set on it)

<input type="text" ng-model="user.firstName" class="form-control better-placeholder" placeholder="First Name" />

Include the following CSS snipets:

.better-placeholder {
  -webkit-transition: all 0.5s ease;
  transition: all 0.5s ease;
}
.better-placeholder::-webkit-input-placeholder {
  display: none;
  opacity: 0;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
  filter: alpha(opacity=0);
}
.better-placeholder::-moz-placeholder {
  display: none;
  opacity: 0;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
  filter: alpha(opacity=0);
}
.better-placeholder:-ms-input-placeholder {
  display: none;
  opacity: 0;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
  filter: alpha(opacity=0);
}
.better-placeholder::placeholder {
  display: none;
  opacity: 0;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
  filter: alpha(opacity=0);
}
.better-placeholder.better-placeholder-active {
  padding: 18px 12px 6px 12px;
  height: auto;
}
.has-error .better-placeholder-text {
  color: #a94442;
}
.has-error .better-placeholder-text.active {
  color: #a94442;
}
.has-success .better-placeholder-text {
  color: #3c763d;
}
.has-success .better-placeholder-text.active {
  color: #3c763d;
}
.has-warning .better-placeholder-text {
  color: #8a6d3b;
}
.has-warning .better-placeholder-text.active {
  color: #8a6d3b;
}
.better-placeholder-text {
  -webkit-transition: all 0.5s ease;
  transition: all 0.5s ease;
  position: absolute;
  top: 2px;
  margin-left: 12px;
  line-height: 20px;
  height: 20px;
  color: #888;
  -webkit-transform-origin: 0 0;
  -ms-transform-origin: 0 0;
  transform-origin: 0 0;
  max-width: 85%;
/* You have to fiddle with this and it .active replacement depending on size of field */
  margin-right: 12px;
  white-space: nowrap;
  overflow: hidden;
  -o-text-overflow: ellipsis;
  text-overflow: ellipsis;
}
.better-placeholder-text.active {
  max-width: 110%;
  visibility: visible;
  -webkit-transform: scale(0.8);
  -ms-transform: scale(0.8);
  transform: scale(0.8);
  -webkit-transform-origin: 0 0;
  -ms-transform-origin: 0 0;
  transform-origin: 0 0;
  color: #428bca;
  top: -2px;
}

Example

angular-better-placeholders's People

Contributors

waffle-iron avatar

Watchers

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