Giter VIP home page Giter VIP logo

flowuplabels.js's Introduction

FlowupLabels.js

Augments form labels to behave like placeholders, but with a twist.

SEE DEMO

Original concept by Matt D. Smith. Inspired by Mike Mitchell's FloatLabel.js.

Difference in this version:

  • The label gets out of the user's way immediately on focus
  • Labels should be proceeded by a colon ":", to indicate that the user still has something to fill. Users commonly mistake placeholder labels as prefilled inputs, an example being the common "Search..."
  • This implementation accounts for pre-filled elements on page load (toggleable)
  • Uses semantic labels, not placeholders

Usage instructions

  • Add jquery.FlowupLabels.css to your stylesheets:
<link rel="stylesheet" href="css/jquery.FlowupLabels.css">
<link rel="stylesheet" href="css/main.css">
  • Add jquery.FlowupLabels.js to your scripts.
<script src="js/jquery.min.js"></script>
<script src="js/jquery.FlowupLabels.js"></script>
<script src="js/main.js"></script>
  • Wrap your form in the '.FlowupLabels' class
  • Wrap your labels and inputs with the '.fl_wrap' class
  • Give labels the '.fl_label' class
  • Give inputs the '.fl_input' class
  • Load the plugin
$('.FlowupLabels').FlowupLabels({
		/*
		These are all the default values
		You may exclude any/all of these options
		if you won't be changing them
		 */
		// Handles the possibility of having input boxes prefilled on page load
		feature_onInitLoad: false, 
		
		// Class when focusing an input
		class_focused: 		'focused',
		// Class when an input has text entered
		class_populated: 	'populated'	
});

Compatibility

Tested in IE8, IE9, IE10, Chrome, Firefox

Size

JS: 1kb regular, ~600 bytes minified, 284 bytes gzipped+minified (Closure Compiler).

CSS: 1.6kb regular, 786 bytes minified.

Total: <2kb minified, <1kb gzipped+minified.


© 2013 ENFOS, Inc.

Licensed under MIT

flowuplabels.js's People

Contributors

walmik avatar

Watchers

James Cloos 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.