Permalink
Browse files

updated file paths

  • Loading branch information...
timwright12 committed Feb 17, 2012
1 parent 6f440a1 commit 752768b5a31570fcad599aaccb4cdce712600e36
Showing with 0 additions and 127 deletions.
  1. +0 −106 js/x_jquery.slidinglabels.js
  2. +0 −21 js/x_jquery.slidinglabels.min.js
@@ -1,106 +0,0 @@
-/*
- Sliding Labels 3.2.1
-
- This is the official plugin version of Sliding Labels.
- It is open source code by Tim Wright of CSSKarma.com
- Use as you see fit, I'd like it if you kept this in
- the code, but basically share it and don't be a jerk.
-
- Support:
- http://www.csskarma.com/blog/sliding-labels-plugin
-
- Version: 2 - added textarea functionality
- Version: 3 - added axis parameter
- - added speed parameter
- - removed color parameter, as it should be define in the CSS
- - added position:relative to wrapping element
- - coverted to jQuery plugin
- Version: 3.1 - changed "children" to "find" so it works a little better with UL & fieldsets
- Version: 3.2 - Added a "className" option so you don't have to use ".slider" as the wrapper
- Version: 3.2.1 - general clean up
-*/
-
-(function($){
-$.fn.slidinglabels = function(options, callback) {
- var defaults = {
- className : 'form-slider',
- topPosition : '5px',
- leftPosition : '5px',
- axis : 'x',
- speed : 'fast'
- },
- options = $.extend(defaults, options),
- itemwrapper = this.find('.' + defaults.className + ''),
- labels = itemwrapper.find('label');
-
- return labels.each(function() {
- obj = $(this);
-
- var parent = obj.parents('.' + defaults.className + '');
- parent.css({'position':'relative'})
-
- // style the label with JS for progressive enhancement
- obj.css({
- 'position' : 'absolute',
- 'top' : defaults.topPosition,
- 'left' : defaults.leftPosition,
- 'display' : 'inline',
- 'z-index' : 99
- });
-
- var inputval = $(this).next().val(),
- labelwidth = $(this).width(),
- labelmove = labelwidth + 5 +'px',
- labelheight = $(this).height();
-
- //onload, check if a field is filled out, if so, move the label out of the way
- if(inputval !== ''){
- if(defaults.axis == 'x'){
- obj.stop().animate({ 'left':'-'+labelmove }, 1);
- } else if(defaults.axis == 'y') {
- obj.stop().animate({ 'top':'-'+labelheight }, 1);
- }
- } //
-
- // if the input is empty on focus move the label to the left
- // if it's empty on blur, move it back
- $('input, textarea').focus(function(){
- var label = $(this).prev('label'),
- width = label.width(),
- height = label.height(),
- adjust = width + 5 + 'px',
- adjustUp = height + 'px',
- value = $(this).val();
-
- if(value == ''){
- if(defaults.axis == 'x'){
- label.stop().animate({ 'left':'-'+adjust }, defaults.speed);
-
- } else if(defaults.axis == 'y') {
- label.stop().animate({ 'top':'-'+adjustUp }, defaults.speed);
- }
- } else {
- if(defaults.axis == 'x'){
- label.css({ 'left':'-'+adjust });
- } else if(defaults.axis == 'y') {
- label.css({ 'top':'-'+adjustUp });
- }
- }
-
- }).blur(function(){
- var label = $(this).prev('label'),
- value = $(this).val();
-
- if(value == ''){
- if(defaults.axis == 'x'){
- label.stop().animate({ 'left': defaults.leftPosition }, defaults.speed);
- } else if(defaults.axis == 'y') {
- label.stop().animate({ 'top': defaults.topPosition }, defaults.speed);
- }
- }
- });
-
- });
-
- }; // End function
-})(jQuery); // End jQuery
@@ -1,21 +0,0 @@
-/*
- Sliding Labels 3.2
-
- This is the official plugin version of Sliding Labels.
- It is open source code by Tim Wright of CSSKarma.com
- Use as you see fit, I'd like it if you kept this in
- the code, but basically share it and don't be a jerk.
-
- Support:
- http://www.csskarma.com/blog/sliding-labels-plugin
-
- Version: 2 - added textarea functionality
- Version: 3 - added axis parameter
- - added speed parameter
- - removed color parameter, as it should be define in the CSS
- - added position:relative to wrapping element
- - coverted to jQuery plugin
- Version: 3.1 - changed "children" to "find" so it works a little better with UL & fieldsets
- Version: 3.2 - Added a "className" option so you don't have to use ".slider" as the wrapper
-*/
-(function(a){a.fn.slidinglabels=function(c,f){var d={className:"form-slider",topPosition:"5px",leftPosition:"5px",axis:"x",speed:"fast"},c=a.extend(d,c),b=this.find("."+d.className+""),e=b.find("label");return e.each(function(){obj=a(this);var j=obj.parents("."+d.className+"");j.css({position:"relative"});obj.css({position:"absolute",top:d.topPosition,left:d.leftPosition,display:"inline","z-index":99});var k=a(this).next().val(),i=a(this).width(),h=i+5+"px",g=a(this).height();if(k!==""){if(d.axis=="x"){obj.stop().animate({left:"-"+h},1)}else{if(d.axis=="y"){obj.stop().animate({top:"-"+g},1)}}}a("input, textarea").focus(function(){var m=a(this).prev("label"),o=m.width(),l=m.height(),q=o+5+"px",n=l+"px",p=a(this).val();if(p==""){if(d.axis=="x"){m.stop().animate({left:"-"+q},d.speed)}else{if(d.axis=="y"){m.stop().animate({top:"-"+n},d.speed)}}}else{if(d.axis=="x"){m.css({left:"-"+q})}else{if(d.axis=="y"){m.css({top:"-"+n})}}}}).blur(function(){var l=a(this).prev("label"),m=a(this).val();if(m==""){if(d.axis=="x"){l.stop().animate({left:d.leftPosition},d.speed)}else{if(d.axis=="y"){l.stop().animate({top:d.topPosition},d.speed)}}}})})}})(jQuery);

0 comments on commit 752768b

Please sign in to comment.