• Stars
    star
    659
  • Rank 67,950 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 11 years ago
  • Updated about 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

jQuery / Zepto plugin to emulate Matt D. Smith's floating placeholder text

#JVFloat.js - Demo

Join the chat at https://gitter.im/maman/JVFloat.js Bitdeli Badge

jQuery and Zepto plugin to emulate the behavior of JVFloatLabeledTextField which based on the concept from Matt D. Smith. Read more on The Blog post

Please note that JVFloat has very basic styles, and only provide the logic of the implementation. view jvfloat.css to see the styles used in the default theme. happy hacking! πŸ‘

#Docs Before you begins, make sure you have included jQuery or Zepto.js on your page.

Installation

JVFloat consist of two parts, jvfloat.js and jvfloat.css. the minified version of the script also avalaible on jvfloat.min.js. to use JVFloat.js on your page, include JVFloat after you load jQuery or Zeptojs, for example:

<head>
	....
	<link rel="stylesheet" href="css/style.css">
	<link rel="stylesheet" href="css/jvfloat.css">
</head>
<body>
	....
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
	<script src="js/jvfloat.min.js"></script>
</body>

I strongly advise you to modify the default CSS file to reflect your current page, as the default CSS only consists the essential element that makes the placeholder showing and hiding animations. Please read the full CSS documentations avalaible below before you make any edit to the CSS file.

Now JVFloat is installable via Bower: bower install JVFloat

Initialization

JVFloat can be initialized by calling jvFloat() functions, for example:

<script>
	$('.testBox').jvFloat();
</script>

by default, JVFloat.js won't process submit buttons, and automatically exclude it from being transformed.

CSS Documentation

.jvFloat

this section performs styling on the div.jvFloat wrapper around the input generated by the script.
Rules that you mustn't remove: position: relative;

.jvFloat .placeHolder

this section performs styling on the span.placeHolder element inside div.jvFloat, where the copy of input placeholder text was stored. it's hidden by default.
Rules that you mustn't remove: position: absolute;, display: none;, visibility: hidden;, opacity: 0;

.jvFloat .placeHolder.required

the styling of the required placeholder. The default color is simply red.

.jvFloat .placeHolder.active

the active state of the aftermentioned section. its job are to display the hidden span.placeHolder when users is typing on the input.
Rules that you mustn't remove: display: block;, visibility: visible;, opacity: 1

Another Notes on CSS

JVFloat uses CSS3 Transform and Transitions to perform the animations by default. Browsers that doesn't support those will simply doesn't show anything when user typing on the input elements. to fix that, enable/uncomment the legacy rules on the default CSS file, and comment out the CSS3 rules.

#TODO

  • Better CSS Animations need your suggestion on this one, btw
  • Better plugin code
  • Write better docs

#Changelog

  • 23/07/2015 - Merged wiredep and label fixes from @ahmadalfy. bump version.
  • 15/04/2014 - Release first stable version of JVFloat.js . add ability to redefine CSS on multiline textarea, thanks to @Jackobyte for the pull request. Also now JVFloat has a grunt-based build system.
  • 31/01/2014 - JVFloat now uses actual <label> elements to improve accessbility. thanks to @MrSnowflake for the pull request
  • 21/12/2013 - Code refactoring. thanks to @eskimoblood for the pull request
  • 11/08/2013 - Add animation when user switch to another form element, thanks to @gabceb for the pull request.
  • 10/23/2013 - Fix the bug where JVFloat process all input elements, including submit, fix the animations β€” it's noticeably smoother! β€”, add support for required inputs, and I'm adding more detailed documentations.
  • 10/12/2013 - First Commit

More Repositories

1

deno-playground

play.golang.org, but built in deno, and for deno.
TypeScript
59
star
2

sertifikat-maido

Maido bersertifikat sehingga dapat meningkatkan gengsi
JavaScript
12
star
3

generator-beautifulsop

She process your markdown files into a PDF document, Beautifully
CSS
8
star
4

dotcss.safariextension

Safari extension for stewart's dotcss, css companion for defunkt's dotjs and wfarr's dotjs.safariextz
JavaScript
6
star
5

dots

me sharing my dotfiles
Vim Script
5
star
6

medunten

Mentranslasi bahasa indonesia ke bahasa madura (baik madura kasar, halus, atau super halus πŸ‘) - atau sebaliknya.
TypeScript
5
star
7

express-telolet

telolet all the way to your user
JavaScript
4
star
8

livepipe

Video content management that includes a RTMP streaming server which "duplicates" your stream to multiple RTMP endpoint
JavaScript
4
star
9

scoop-bucket

Additional buckets for scoop - homebrew for windows
Batchfile
3
star
10

tovbtle

a template for Toto blogging engine based on dcurtis' famous svbtle
CSS
2
star
11

characters

Use swapi to fetch and display all star wars characters
JavaScript
2
star
12

mipad4-enable-otg

Enable OTG support on Mi Pad 4 / 4 Plus via magisk's systemless method
Shell
1
star
13

sar

Sistem Informasi tracking RPP dan Self Assest Report untuk dosen
Java
1
star
14

rewardly-merchant

Rewardly Merchant web application
JavaScript
1
star
15

get-gh-pinned-repos

JavaScript
1
star
16

Portal

Aplikasi web portal berbasis PHP untuk manajemen anggota, berita, dan lowongan pekerjaan πŸ‘Œ
CSS
1
star
17

mnx

nix config
Nix
1
star
18

abcee

alphabet learning for kids
CSS
1
star
19

react-router-legacy

Maintained version of react-router v2
JavaScript
1
star
20

vim-config

My vim/neovim config files
Vim Script
1
star
21

multiplatform

Single codebase, multiple platform target.
Objective-C
1
star
22

tinderweb

Tinder's missing web client
PHP
1
star