Advertisement
pezzzz

Untitled

Jun 13th, 2012
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 2.20 KB | None | 0 0
  1. setupLoginForm: function() {
  2.       $("#signin-button").click( function(event) {
  3.         event.stopPropagation();
  4.         var formWrapper = $("#block-user-login-form-wrapper");
  5.         if (formWrapper.position().top) {
  6.           $("#block-user-login-form-wrapper").stop().animate({
  7.             top: "0px"
  8.           });
  9.           $(this).removeClass("enabled");
  10.         } else {
  11.           $("#block-user-login-form-wrapper").stop().animate({
  12.             top: "-128px"
  13.           }, null, null, function() {
  14.             $("#signin-button").addClass("enabled");
  15.           });
  16.         }
  17.       });
  18.       $("#signin-button").qtip({
  19.         content: {
  20.           text: "Accedi al sito con il tuo account"
  21.         },
  22.         position: {
  23.           target: 'mouse',
  24.           adjust: {
  25.             x: 10,
  26.             y: 10
  27.           }
  28.         }
  29.       });
  30.       $("#block-user-login-form").click( function(event) {
  31.         event.stopPropagation();
  32.       });
  33.       $('html').click( function(event) {
  34.         var formWrapper = $("#block-user-login-form-wrapper");
  35.         if (formWrapper != null && formWrapper.position() != null && formWrapper.position().top == 0) {
  36.           $("#block-user-login-form-wrapper").stop().animate({
  37.             top: "-128px"
  38.           }, null, null, function() {
  39.             $("#signin-button").addClass("enabled");
  40.           });
  41.           event.stopPropagation();
  42.         }
  43.       });
  44.       $("#user-login-form").validate({
  45.         showErrors: function(errorMap, errorList) {
  46.           $(errorList).each( function(index, value) {
  47.             //$(value.element.parentNode).children("label").hide();
  48.             var label = $(value.element.parentNode).children("label");
  49.             var defaultColor = label.css("color");
  50.             label.animate({
  51.               color: "red"
  52.             }, 250, "swing", function() {
  53.               $(this).animate({
  54.                 color: defaultColor
  55.               }, 1000);
  56.             });
  57.           });
  58.         },
  59.         focusCleanup: true,
  60.         focusInvalid: false,
  61.         unhighlight: function(element, errorClass, validClass) {
  62.           $(element.form).find("label[for=" + element.id + "]").show();
  63.         }
  64.       });
  65.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement