Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="successful_login" class="fix-middle">
  <div class="container text-center">
    <h1>Welcome back to the internet!</h1>
    <p>You've successfully managed to log into a nonexistant account in order to test a login dialog box.<br> If you like it, you are welcomed to use it wherever you want, no strings attached.<br><br><a href="#" class="link dialog-reset">Rerun the whole thing.</a></p>
  </div>
</div>
<div id="successful_registration" class="fix-middle">
  <div class="container text-center">
    <h1>Welcome to the internet!</h1>
    <p>You've successfully managed to register for a nonexistant account in order to test a registration dialog box.<br> If you like it, you are welcomed to use it wherever you want, no strings attached.<br><br><a href="#" class="link dialog-reset">Rerun the whole thing.</a></p>
  </div>
</div>

<div id="dialog" class="dialog dialog-effect-in">
  <div class="dialog-front">
    <div class="dialog-content">
      <form id="login_form" class="dialog-form" action="" method="POST">
        <fieldset>
          <legend>Log in</legend>
          <div class="form-group">
            <label for="user_username" class="control-label">Username:</label>
            <input type="text" id="user_username" class="form-control" name="user_username" autofocus/>
          </div>
          <div class="form-group">
            <label for="user_password" class="control-label">Password:</label>
            <input type="password" id="user_password" class="form-control" name="user_password"/>
          </div>
          <div class="text-center pad-top-20">
            <p>Have you forgotten your<br><a href="#" class="link"><strong>username</strong></a> or <a href="#" class="link"><strong>password</strong></a>?</p>
          </div>
          <div class="pad-top-20 pad-btm-20">
            <input type="submit" class="btn btn-default btn-block btn-lg" value="Continue">
          </div>
          <div class="text-center">
            <p>Do you wish to register<br> for <a href="#" class="link user-actions"><strong>a new account</strong></a>?</p>
          </div>
        </fieldset>
      </form>
    </div>
  </div>
  <div class="dialog-back">
    <div class="dialog-content">
      <form id="register_form" class="dialog-form" action="" method="POST">
        <fieldset>
          <legend>Register</legend>
          <div class="form-group">
            <label for="user_username" class="control-label">Username:</label>
            <input type="text" id="user_username" class="form-control" name="user_username"/> 
          </div>
          <div class="form-group">
            <label for="user_password" class="control-label">Password:</label>
            <input type="password" id="user_password" class="form-control" name="user_password"/>
          </div>
          <div class="form-group">
            <label for="user_cnf_password" class="control-label">Confirm password:</label>
            <input type="password" id="user_cnf_password" class="form-control" name="user_cnf_password"/>
          </div>
          <div class="form-group pad-top-20 form-group-checkbox">
            <div class="checkbox">
              <label>
                <input type="checkbox" id="user_terms" name="user_terms">
                I have read and I agree with the Terms and Conditions
              </label>
            </div>
          </div>
          <div class="pad-btm-20">
            <input type="submit" class="btn btn-default btn-block btn-lg" value="Continue"/>
          </div>
          <div class="text-center">
            <p>Return to <a href="#" class="link user-actions"><strong>log in page</strong></a>?</p>
          </div>
        </fieldset>
      </form>
    </div>
  </div>
</div>
              
            
!

CSS

              
                /// Hey, listen up before you dig into the code! This widget (or whatever you want to call it), is based on Bootstrap 3+. This means that most of the bootstrap mixins listed below, are already included in the "less" files that come along when downloading Bootstrap(source). However, the custom mixins are new and are required for this widget to work.

// HELPFUL MIXINS
// Bootstrap mixins:

.translate(@x; @y) {
  -webkit-transform: translate(@x, @y);
     -moz-transform: translate(@x, @y);
      -ms-transform: translate(@x, @y);
          transform: translate(@x, @y);
}

.animation(@animation) {
  -webkit-animation: @animation;
     -moz-animation: @animation;
       -ms-animation: @animation;
          animation: @animation;
}

.animation-delay(@delay) {
  -webkit-animation-delay: @delay;
     -moz-animation-delay: @delay;
      -ms-animation-delay: @delay;
          animation-delay: @delay;
}

.backface-visibility(@visibility){
  -webkit-backface-visibility: @visibility;
     -moz-backface-visibility: @visibility;
      -ms-backface-visibility: @visibility;
          backface-visibility: @visibility;
          
}

.transition(@transition) {
  -webkit-transition: @transition;
     -moz-transition: @transition;
      -ms-transition: @transition;
          transition: @transition;
}

.box-shadow(@shadow) {
  -webkit-box-shadow: @shadow;
     -moz-box-shadow: @shadow;
      -ms-box-shadow: @shadow;
          box-shadow: @shadow;
}


// Custom mixins
.effect(@name; @arguments){
    @-webkit-keyframes @name { @arguments();}
    @-moz-keyframes @name { @arguments();}
    @keyframes @name { @arguments();}
}
    
.generate-paddings(5);
.generate-paddings(@n, @i: 1) when (@i =< @n) {
    @x : (@i*20);
    .pad-top-@{x} {
        padding-top: (@i * 20px);
    }
    .pad-btm-@{x} {
        padding-bottom: (@i * 20px);
    }
    .pad-sep-@{x} {
        padding-top: (@i * 20px);
        padding-bottom: (@i * 20px);
    }
    .generate-paddings(@n, (@i + 1));
}
    
.perspective(@perspective){
    -webkit-perspective: @perspective;
       -moz-perspective: @perspective;
        -ms-perspective: @perspective;
         -o-perspective: @perspective;
            perspective: @perspective;
}

.transform(@string){
	-webkit-transform: @string;
	   -moz-transform: @string;
	    -ms-transform: @string;
	     -o-transform: @string;
}

// Helpful variables
    
@import url(https://fonts.googleapis.com/css?family=Roboto:400,500,700,300,100);

// Bootstrap standard variables:
@body-bg: #222;
@text-color: #fff;
@font-family-sans-serif: 'Roboto', Helvetica, Arial, sans-serif;
@font-size-base: 14px;
@headings-font-weight: 300;

@brand-primary: #22A7F0;
@brand-success: #00B16A;
@brand-warning: #F39C12;
@brand-danger: #E74C3C;

// Custom variables:
@dialog-bg: #fff;
@dialog-color: #222;
@dialog-width: 300px;
@dialog-padding: 20px 25px;
@dialog-input-border: 2px solid #222;
@dialog-input-bg: transparent;
@dialog-checkbox: 20px;

// Custom variables that modify the way "btn-default" looks and feels.
@dialog-btn-primary-bg: #446CB3; //darken(@dialog-bg,10%);
@dialog-btn-primary-color: #fff; //@dialog-color;

@dialog-btn-primary-bg-hover: @dialog-color;
@dialog-btn-primary-color-hover: @dialog-bg;

// Basic styling
html,body {
  height:100%;  
}

body {
  margin: 0;
  padding:0;
  color:@text-color;
  overflow:hidden;
  background-color:@body-bg;
  font-size: @font-size-base;
  position:relative;
  font-family: @font-family-sans-serif;
}

h1,.h1,h2,.h2,h3,.h3 {
  font-weight:@headings-font-weight;
  color:@brand-primary;
}

.fix-middle {
    position: absolute;
    padding:10px;
    top:50%;
    left:50%;
    .translate(-50%; -50%);
    z-index:3;
}

// LOGIN/REGISTER WIDGET STYLING STARTS HERE:

.dialog{
    color:@dialog-color;
    .perspective(1200px);
    z-index:1000;
    opacity:1;
    visibility: visible;
  -webkit-transition: opacity .2s cubic-bezier(.25,.5,.5,.9),visibility .2s cubic-bezier(.25,.5,.5,.9);
     -moz-transition: opacity .2s cubic-bezier(.25,.5,.5,.9),visibility .2s cubic-bezier(.25,.5,.5,.9);
      -ms-transition: opacity .2s cubic-bezier(.25,.5,.5,.9),visibility .2s cubic-bezier(.25,.5,.5,.9);
          transition: opacity .2s cubic-bezier(.25,.5,.5,.9),visibility .2s cubic-bezier(.25,.5,.5,.9);
  &, & .dialog-front, & .dialog-back {
    width:auto;
    position:absolute;
    top:50%;
    left:50%;
    padding:0;
    margin:0;
    .translate(-50%;-50%);
  }
  &.dialog-effect-in{
    .animation(showDialog 1000ms linear both);
  }  
  &.shakeit {
    .animation(shakeDialog 300ms linear both);
  }
  .dialog-content {
    width:@dialog-width;
    background: @dialog-bg; /* Old browsers */
    background: -moz-radial-gradient(center, ellipse cover,  #ffffff 59%, #e5e5e5 100%); /* FF3.6+ */
    background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(59%,#ffffff), color-stop(100%,#e5e5e5)); /* Chrome,Safari4+ */
    background: -webkit-radial-gradient(center, ellipse cover,  #ffffff 59%,#e5e5e5 100%); /* Chrome10+,Safari5.1+ */
    background: -o-radial-gradient(center, ellipse cover,  #ffffff 59%,#e5e5e5 100%); /* Opera 12+ */
    background: -ms-radial-gradient(center, ellipse cover,  #ffffff 59%,#e5e5e5 100%); /* IE10+ */
    background: radial-gradient(ellipse at center,  #ffffff 59%,#e5e5e5 100%); /* W3C */
    border-radius:6px;
    .box-shadow(0 2px 12px -3px rgba(0,0,0,.6));
    padding:@dialog-padding;
  }
  
  .dialog-front,.dialog-back{
      -webkit-transform-style: preserve-3d;
      -moz-transform-style: preserve-3d;
      .backface-visibility(hidden);
      .transition(all .4s cubic-bezier(.25,.5,.5,.9));
  }
  .dialog-front{
    .transform(translate(-50%,-50%) rotateX(0deg) rotateY(0deg));
    z-index: 900;
    
  }
  .dialog-back {
    .transform(translate(-50%,-50%) rotateY(-180deg));
    z-index: 800;
  }  
  &.flip {
    .dialog-front{
      z-index: 800;
      visibility:hidden;
      .transform(translate(-50%,-50%) rotateY(180deg));      
    }
    .dialog-back {
      z-index: 900;
      visibility:visible;
      .transform(translate(-50%,-50%) rotateX(0deg) rotateY(0deg)); 
    }
  }
  &.dialog-effect-out {
    z-index:1;
    opacity:0; 
    visibility: hidden;
    .dialog-front{
         .transform(translate(-50%,-20%) rotateX(-30deg)); 
    }
    .dialog-back {
         .transform(translate(-50%,-20%) rotateX(-30deg) rotateY(-180deg)); 
    }
    &.flip {
      .dialog-front{
          .transform(translate(-50%,-20%) rotateX(-30deg) rotateY(180deg));
      }
      .dialog-back {
          .transform(translate(-50%,-20%) rotateX(-30deg) rotateY(0deg));
      }
    }
    .dialog-content {
      background:@brand-success;
      .dialog-form {
        visibility:hidden;
      }
    }
  }
  .dialog-form {
    .animation(swooshUp30 300ms linear both);
    .animation-delay(300ms);
    legend {
        margin-bottom: 40px;
        font-size: 26px;
        font-weight:@headings-font-weight;
        color: @dialog-color;
        border-bottom: none;
    }
  .form-group {
    margin-bottom: 20px;
    position:relative;
    .form-control {
      color: @dialog-color;
      background-color: @dialog-input-bg;
      border: none;
      border-bottom:@dialog-input-border;
      border-radius:0;
      .box-shadow(none);      
    }
    label {
      display: inline-block;
      max-width: 100%;
      margin-bottom: 5px;
      font-weight: 700;
    }
    &.has-error {
      .error-msg {
        display:block;
      }
      label {
        color: @brand-danger;
      }
      .form-control {
        border-color: @brand-danger;
      } 
    }
    .checkbox {
      label {
        padding-left:40px;
      }
      input[type="checkbox"] {
        width: @dialog-checkbox;
        height: @dialog-checkbox;
        background:none;
        border:@dialog-input-border;
        margin-left:(-20px + @dialog-checkbox*-1);
        -webkit-appearance:none;
        appearance:none;
        &:hover {
          background-color:darken(@dialog-bg,10%);
        }
        &:checked {
          background-color:@dialog-color;
        }
        &:disabled {
          background-color:lighten(@dialog-color,30%);
          border-color:lighten(@dialog-color,20%);
        }
      }
    }
  }
  .error-msg {
        position: absolute;
        top: 50%;
        left: 0;
        right: auto;
        background-color: @brand-danger;
        color:@dialog-bg;
        padding: 10px;
        z-index: 3;      
        max-width: (@dialog-width/2);
        border-radius:3px;
        .translate(-110%; -50%);        
        .animation(swooshleft 200ms ease-in-out both);
        display:none;      
        &:after {
          position:absolute;
          content:'';
          top:50%;
          right:0;
          .translate(97%; -50%);
          width: 0;
          height: 0;
          border-style: solid;
          border-width: 10px 0 10px 10px;
          border-color: transparent transparent transparent @brand-danger;
        }
  }
  .btn {
    font-weight:700;
    border-width:0;
    border-radius:0;
    text-transform:uppercase;
    .transition(all .2s cubic-bezier(.25,.5,.5,.9));
    &.btn-default {
      color:@dialog-btn-primary-color;
      background-color: @dialog-btn-primary-bg;
      margin: 0 -10%;
      width: 120%;
      outline:none;
      &:hover{
        background-color: @dialog-btn-primary-bg-hover;
        color:@dialog-btn-primary-color-hover;
      }
      &:active,&:focus {
        background-color: @dialog-btn-primary-bg-hover;
        color:@dialog-btn-primary-color-hover;
      }
    }
  }
}
}

.effect(swooshUp30; {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
});

.effect(swooshleft; {
    0% {
        .translate(-90%; -50%);
    }
    100% {
        .translate(-110%; -50%);
    }
});

.effect(shakeDialog; {
    0% {
        left:51%;
    }
    25% {
        left:49%;
    }
    50% {
        left:51%;
    }
    100% {
        left:50%;
    }
});

/* Generated with Bounce.js. Edit at https://goo.gl/KtDT8H */

@-webkit-keyframes showDialog { 
  0% { -webkit-transform: matrix3d(0.8, 0, 0, 0, 0, 0.8, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.8, 0, 0, 0, 0, 0.8, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  7.61% { -webkit-transform: matrix3d(0.907, 0, 0, 0, 0, 0.907, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.907, 0, 0, 0, 0, 0.907, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  11.41% { -webkit-transform: matrix3d(0.948, 0, 0, 0, 0, 0.948, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.948, 0, 0, 0, 0, 0.948, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  15.12% { -webkit-transform: matrix3d(0.976, 0, 0, 0, 0, 0.976, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.976, 0, 0, 0, 0, 0.976, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  18.92% { -webkit-transform: matrix3d(0.996, 0, 0, 0, 0, 0.996, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.996, 0, 0, 0, 0, 0.996, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  22.72% { -webkit-transform: matrix3d(1.008, 0, 0, 0, 0, 1.008, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(1.008, 0, 0, 0, 0, 1.008, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  30.23% { -webkit-transform: matrix3d(1.014, 0, 0, 0, 0, 1.014, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(1.014, 0, 0, 0, 0, 1.014, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  50.25% { -webkit-transform: matrix3d(1.003, 0, 0, 0, 0, 1.003, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(1.003, 0, 0, 0, 0, 1.003, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  70.27% { -webkit-transform: matrix3d(0.999, 0, 0, 0, 0, 0.999, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.999, 0, 0, 0, 0, 0.999, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  100% { -webkit-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } 
}

@keyframes showDialog { 
  0% { -webkit-transform: matrix3d(0.8, 0, 0, 0, 0, 0.8, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.8, 0, 0, 0, 0, 0.8, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  7.61% { -webkit-transform: matrix3d(0.907, 0, 0, 0, 0, 0.907, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.907, 0, 0, 0, 0, 0.907, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  11.41% { -webkit-transform: matrix3d(0.948, 0, 0, 0, 0, 0.948, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.948, 0, 0, 0, 0, 0.948, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  15.12% { -webkit-transform: matrix3d(0.976, 0, 0, 0, 0, 0.976, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.976, 0, 0, 0, 0, 0.976, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  18.92% { -webkit-transform: matrix3d(0.996, 0, 0, 0, 0, 0.996, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.996, 0, 0, 0, 0, 0.996, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  22.72% { -webkit-transform: matrix3d(1.008, 0, 0, 0, 0, 1.008, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(1.008, 0, 0, 0, 0, 1.008, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  30.23% { -webkit-transform: matrix3d(1.014, 0, 0, 0, 0, 1.014, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(1.014, 0, 0, 0, 0, 1.014, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  50.25% { -webkit-transform: matrix3d(1.003, 0, 0, 0, 0, 1.003, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(1.003, 0, 0, 0, 0, 1.003, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  70.27% { -webkit-transform: matrix3d(0.999, 0, 0, 0, 0, 0.999, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(0.999, 0, 0, 0, 0, 0.999, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }
  100% { -webkit-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); } 
}

// This stiling is not a part of the widget.

#successful_login, #successful_registration{
  opacity:0;
  visibility:hidden;
  -webkit-transition: opacity .4s cubic-bezier(.25,.5,.5,.9),visibility .6s cubic-bezier(.25,.5,.5,.9);
     -moz-transition: opacity .4s cubic-bezier(.25,.5,.5,.9),visibility .6s cubic-bezier(.25,.5,.5,.9);
      -ms-transition: opacity .4s cubic-bezier(.25,.5,.5,.9),visibility .6s cubic-bezier(.25,.5,.5,.9);
          transition: opacity .4s cubic-bezier(.25,.5,.5,.9),visibility .6s cubic-bezier(.25,.5,.5,.9);
  &.active {
    opacity:1;
    visibility:visible;
  }
}
              
            
!

JS

              
                
    // The "getFormData()" function retrieves the names and values of each input field in the form; 

    function getFormData(form) {
      var data = {};
      $(form).find('input, select').each(function() {
        if (this.tagName.toLowerCase() == 'input') {
          if (this.type.toLowerCase() == 'checkbox') {
            data[this.name] = this.checked;
          } else if (this.type.toLowerCase() != 'submit') {
            data[this.name] = this.value;
          }
        } else {
          data[this.name] = this.value;
        }
      });
      return data;
    }

    // The "addFormError()" function, when called, adds the "error" class to the form-group that wraps around the "formRow" attribute;

    function addFormError(formRow, errorMsg) {
      var errorMSG = '<span class="error-msg">' + errorMsg + '</span>';
      $(formRow).parents('.form-group').addClass('has-error');
      $(formRow).parents('.form-group').append(errorMSG);
      $('#dialog').removeClass('dialog-effect-in');
      $('#dialog').addClass('shakeit');
      setTimeout(function() {
        $('#dialog').removeClass('shakeit');
      }, 300);
    }

    // FORM HANDLER:

    // form_name - This attribute ties the form-handler function to the form you want to submit through ajax. Requires an ID (ex: #myfamousid)
    // custom_validation - 

    function form_handler(form_name, custom_validation, success_message, error_message, success_function, error_function) {
      $(form_name).find('input[type="submit"]').on('click', function(e) { // if submit button is clicked

        window.onbeforeunload = null; // cancels the alert message for unsaved changes (if such function exists)

        $(form_name).find('.form-group .error-msg').remove();
        var submitButton = this;
        submitButton.disabled = true; // Disables the submit buttton until the rows pass validation or we get a response from the server.

        var form = $(form_name)[0];
        // The custom validation function must return true or false.
        if (custom_validation != null) {
          if (!custom_validation(form, getFormData(form))) {
            submitButton.disabled = false;
            return false;
          }
        }
        e.preventDefault(); //STOP default action
      });
      $(document).click(function(e) { // Whenever the user clicks inside the form, the error messages will be removed.
        if ($(e.target).closest(form_name).length) {
          $(form_name).find('.form-group').removeClass('has-error');
          setTimeout(function() {
            $(form_name).find('.form-group .error-msg').remove();
          }, 300);
        } else {
          return
        }
      });
    }

    // LOGIN FORM: Validation function
    function validate_login_form(form, data) {
      if (data.user_username == "") {
        // if username variable is empty
        addFormError(form["user_username"], 'The username is invalid');
        return false; // stop the script if validation is triggered
      }

      if (data.user_password == "") {
        // if password variable is empty
        addFormError(form["user_password"], 'The password is invalid');
        return false; // stop the script if validation is triggered
      }

      $('#dialog').removeClass('dialog-effect-in').removeClass('shakeit');
      $('#dialog').addClass('dialog-effect-out');

      $('#successful_login').addClass('active');
      //return true;
    }

    // REGISTRATION FORM: Validation function
    function validate_registration_form(form, data) {
      if (data.user_username == "") {
        // if username variable is empty
        addFormError(form["user_username"], 'The username is invalid');
        return false; // stop the script if validation is triggered
      }

      if (data.user_password == "") {
        // if password variable is empty
        addFormError(form["user_password"], 'The password is invalid');
        return false; // stop the script if validation is triggered
      }

      if (data.user_cnf_password == "" || data.user_password != data.user_cnf_password) {
        // if password variable is empty
        addFormError(form["user_cnf_password"], "The passwords don't match");
        return false; // stop the script if validation is triggered
      }

      if (!data.user_terms) {
        // if password variable is empty
        addFormError(form["user_terms"], "You need to read and accept the Terms and Conditions before proceeding");
        return false; // stop the script if validation is triggered
      }
      
      $('#dialog').removeClass('dialog-effect-in').removeClass('shakeit');
      $('#dialog').addClass('dialog-effect-out');
      
      $('#successful_registration').addClass('active');
      //return true;
    }

    form_handler("#login_form", validate_login_form, null, null, null, null, null, null);
    form_handler("#register_form", validate_registration_form, null, null, null, null, null, null);

    var dialogBox = $('#dialog');

    dialogBox.on('click', 'a.user-actions', function() {
      dialogBox.toggleClass('flip');
    });

    $('#successful_login,#successful_registration').on('click', 'a.dialog-reset', function() {
      $('#successful_login,#successful_registration').removeClass('active');
      dialogBox.removeClass('dialog-effect-out').addClass('dialog-effect-in');
      document.getElementById('login_form').reset();
      document.getElementById('register_form').reset();
    });
              
            
!
999px

Console