Untitled diff
412 lines
<!DOCTYPE html>
<html>
<html>
<head>
<head>
<style>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
*{
<title> - jsFiddle demo</title>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.8.0.js'></script>
<link rel="stylesheet" type="text/css" href="/css/result-light.css">
<style type='text/css'>
*{
margin:0px;
margin:0px;
padding:0px;
padding:0px;
}
}
body{
body{
color:blue;
color:blue;
font-size:13px;
font-size:13px;
background: #b2b2b2;
background: #b2b2b2;
font-family:"Century Gothic", Helvetica, sans-serif;
font-family:"Century Gothic", Helvetica, sans-serif;
}
}
#content{
#content{
margin:15px auto;
margin:15px auto;
text-align:center;
text-align:center;
width:600px;
width:600px;
position:relative;
position:relative;
height:100%;
height:100%;
}
}
#wrapper{
#wrapper{
-moz-box-shadow:0px 0px 3px #aaa;
-moz-box-shadow:0px 0px 3px #aaa;
-webkit-box-shadow:0px 0px 3px #aaa;
-webkit-box-shadow:0px 0px 3px #aaa;
box-shadow:0px 0px 3px #aaa;
box-shadow:0px 0px 3px #aaa;
-moz-border-radius:10px;
-moz-border-radius:10px;
-webkit-border-radius:10px;
-webkit-border-radius:10px;
border-radius:10px;
border-radius:10px;
border:2px solid #fff;
border:2px solid #fff;
background-color:gray;
background-color:gray;
width:600px;
width:600px;
overflow:hidden;
overflow:hidden;
}
}
#steps{
#steps{
width:600px;
width:600px;
/* height:320px;*/
/* height:320px;*/
overflow:hidden;
overflow:hidden;
}
}
.step{
.step{
float:left;
float:left;
width:600px;
width:600px;
/*height:320px;*/
/*height:320px;*/
}
}
#navigation{
#navigation{
height:45px;
height:45px;
background-color:#e9e9e9;
background-color:#e9e9e9;
border-top:1px solid #fff;
border-top:1px solid #fff;
-moz-border-radius:0px 0px 10px 10px;
-moz-border-radius:0px 0px 10px 10px;
-webkit-border-bottom-left-radius:10px;
-webkit-border-bottom-left-radius:10px;
-webkit-border-bottom-right-radius:10px;
-webkit-border-bottom-right-radius:10px;
border-bottom-left-radius:10px;
border-bottom-left-radius:10px;
border-bottom-right-radius:10px;
border-bottom-right-radius:10px;
}
}
#navigation ul{
#navigation ul{
list-style:none;
list-style:none;
float:left;
float:left;
margin-left:22px;
margin-left:22px;
}
}
#navigation ul li{
#navigation ul li{
float:left;
float:left;
border-right:1px solid #ccc;
border-right:1px solid #ccc;
border-left:1px solid #ccc;
border-left:1px solid #ccc;
position:relative;
position:relative;
margin:0px 2px;
margin:0px 2px;
}
}
#navigation ul li a{
#navigation ul li a{
display:block;
display:block;
height:45px;
height:45px;
background-color:#444;
background-color:#444;
color:#777;
color:#777;
outline:none;
outline:none;
font-weight:bold;
font-weight:bold;
text-decoration:none;
text-decoration:none;
line-height:45px;
line-height:45px;
padding:0px 20px;
padding:0px 20px;
border-right:1px solid #fff;
border-right:1px solid #fff;
border-left:1px solid #fff;
border-left:1px solid #fff;
background:#f0f0f0;
background:#f0f0f0;
background:
background:
-webkit-gradient(
-webkit-gradient(
linear,
linear,
left bottom,
left bottom,
left top,
left top,
color-stop(0.09, rgb(240,240,240)),
color-stop(0.09, rgb(240,240,240)),
color-stop(0.55, rgb(227,227,227)),
color-stop(0.55, rgb(227,227,227)),
color-stop(0.78, rgb(240,240,240))
color-stop(0.78, rgb(240,240,240))
);
);
background:
background:
-moz-linear-gradient(
-moz-linear-gradient(
center bottom,
center bottom,
rgb(240,240,240) 9%,
rgb(240,240,240) 9%,
rgb(227,227,227) 55%,
rgb(227,227,227) 55%,
rgb(240,240,240) 78%
rgb(240,240,240) 78%
)
)
}
}
#navigation ul li a:hover,
#navigation ul li a:hover,
#navigation ul li.selected a{
#navigation ul li.selected a{
background:#d8d8d8;
background:#d8d8d8;
color:#666;
color:#666;
text-shadow:1px 1px 1px #fff;
text-shadow:1px 1px 1px #fff;
}
}
span.checked{
span.checked{
background:transparent url(../images/checked.png) no-repeat top left;
background:transparent url(../images/checked.png) no-repeat top left;
position:absolute;
position:absolute;
top:0px;
top:0px;
left:1px;
left:1px;
width:20px;
width:20px;
height:20px;
height:20px;
}
}
span.error{
span.error{
background:transparent url(../images/error.png) no-repeat top left;
background:transparent url(../images/error.png) no-repeat top left;
position:absolute;
position:absolute;
top:0px;
top:0px;
left:1px;
left:1px;
width:20px;
width:20px;
height:20px;
height:20px;
}
}
#steps form fieldset{
#steps form fieldset{
border:none;
border:none;
padding-bottom:20px;
padding-bottom:20px;
}
}
#steps form legend{
#steps form legend{
text-align:left;
text-align:left;
background-color:#f0f0f0;
background-color:#f0f0f0;
color:#666;
color:#666;
font-size:24px;
font-size:24px;
text-shadow:1px 1px 1px #fff;
text-shadow:1px 1px 1px #fff;
font-weight:bold;
font-weight:bold;
float:left;
float:left;
width:590px;
width:590px;
padding:5px 0px 5px 10px;
padding:5px 0px 5px 10px;
margin:10px 0px;
margin:10px 0px;
border-bottom:1px solid #fff;
border-bottom:1px solid #fff;
border-top:1px solid #d9d9d9;
border-top:1px solid #d9d9d9;
}
}
#steps form p{
#steps form p{
float:left;
float:left;
clear:both;
clear:both;
margin:5px 0px;
margin:5px 0px;
background-color:#f4f4f4;
background-color:#f4f4f4;
border:1px solid #fff;
border:1px solid #fff;
width:400px;
width:400px;
padding:10px;
padding:10px;
margin-left:100px;
margin-left:100px;
-moz-border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
border-radius: 5px;
-moz-box-shadow:0px 0px 3px #aaa;
-moz-box-shadow:0px 0px 3px #aaa;
-webkit-box-shadow:0px 0px 3px #aaa;
-webkit-box-shadow:0px 0px 3px #aaa;
box-shadow:0px 0px 3px #aaa;
box-shadow:0px 0px 3px #aaa;
}
}
#steps form p label{
#steps form p label{
width:160px;
width:160px;
float:left;
float:left;
text-align:right;
text-align:right;
margin-right:15px;
margin-right:15px;
line-height:26px;
line-height:26px;
color:#666;
color:#666;
text-shadow:1px 1px 1px #fff;
text-shadow:1px 1px 1px #fff;
font-weight:bold;
font-weight:bold;
}
}
#steps form input:not([type=radio]),
#steps form input:not([type=radio]),
#steps form textarea,
#steps form textarea,
#steps form select{
#steps form select{
background: #ffffff;
background: #ffffff;
border: 1px solid #ddd;
border: 1px solid #ddd;
-moz-border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
border-radius: 3px;
outline: none;
outline: none;
padding: 5px;
padding: 5px;
width: 200px;
width: 200px;
float:left;
float:left;
}
}
#steps form input:focus{
#steps form input:focus{
-moz-box-shadow:0px 0px 3px #aaa;
-moz-box-shadow:0px 0px 3px #aaa;
-webkit-box-shadow:0px 0px 3px #aaa;
-webkit-box-shadow:0px 0px 3px #aaa;
box-shadow:0px 0px 3px #aaa;
box-shadow:0px 0px 3px #aaa;
background-color:#FFFEEF;
background-color:#FFFEEF;
}
}
#steps form p.submit{
#steps form p.submit{
background:none;
background:none;
border:none;
border:none;
-moz-box-shadow:none;
-moz-box-shadow:none;
-webkit-box-shadow:none;
-webkit-box-shadow:none;
box-shadow:none;
box-shadow:none;
}
}
#steps form button {
#steps form button {
border:none;
border:none;
outline:none;
outline:none;
-moz-border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
border-radius: 10px;
color: #ffffff;
color: #ffffff;
display: block;
display: block;
cursor:pointer;
cursor:pointer;
margin: 0px auto;
margin: 0px auto;
clear:both;
clear:both;
padding: 7px 25px;
padding: 7px 25px;
text-shadow: 0 1px 1px #777;
text-shadow: 0 1px 1px #777;
font-weight:bold;
font-weight:bold;
font-family:"Century Gothic", Helvetica, sans-serif;
font-family:"Century Gothic", Helvetica, sans-serif;
font-size:22px;
font-size:22px;
-moz-box-shadow:0px 0px 3px #aaa;
-moz-box-shadow:0px 0px 3px #aaa;
-webkit-box-shadow:0px 0px 3px #aaa;
-webkit-box-shadow:0px 0px 3px #aaa;
box-shadow:0px 0px 3px #aaa;
box-shadow:0px 0px 3px #aaa;
background:#4797ED;
background:#4797ED;
}
}
#steps form button:hover {
#steps form button:hover {
background:#d8d8d8;
background:#d8d8d8;
color:#666;
color:#666;
text-shadow:1px 1px 1px #fff;
text-shadow:1px 1px 1px #fff;
}?
}
</style>
</style>
<script src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
<script>
$(function() {
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
$(function() {
/*
/*
number of fieldsets
number of fieldsets
*/
*/
var fieldsetCount = $('#formElem').children().length;
var fieldsetCount = $('#formElem').children().length;
/*
/*
current position of fieldset / navigation link
current position of fieldset / navigation link
*/
*/
var current =1;
var current =1;
/*
/*
sum and save the widths of each one of the fieldsets
sum and save the widths of each one of the fieldsets
set the final sum as the total width of the steps element
set the final sum as the total width of the steps element
*/
*/
var stepsWidth = 0;
var stepsWidth = 0;
var widths = new Array();
var widths = new Array();
$('#steps .step').each(function(i){
$('#steps .step').each(function(i){
var $step = $(this);
var $step = $(this);
widths[i] = stepsWidth;
widths[i] = stepsWidth;
stepsWidth += $step.width();
stepsWidth += $step.width();
});
});
$('#steps').width(stepsWidth);
$('#steps').width(stepsWidth);
/*
/*
to avoid problems in IE, focus the first input of the form
to avoid problems in IE, focus the first input of the form
*/
*/
$('#formElem').children(':first').find(':input:first').focus();
$('#formElem').children(':first').find(':input:first').focus();
/*
/*
show the navigation bar
show the navigation bar
*/
*/
$('#navigation').show();
$('#navigation').show();
/*
/*
when clicking on a navigation link
when clicking on a navigation link
the form slides to the corresponding fieldset
the form slides to the corresponding fieldset
*/
*/
$('#navigation a').bind('click',function(e){
$('#navigation a').bind('click',function(e){
var $this = $(this);
var $this = $(this);
var prev = current;
var prev = current;
$this.closest('ul').find('li').removeClass('selected');
$this.closest('ul').find('li').removeClass('selected');
$this.parent().addClass('selected');
$this.parent().addClass('selected');
/*
/*
we store the position of the link
we store the position of the link
in the current variable
in the current variable
*/
*/
current = $this.parent().index() + 1;
current = $this.parent().index() + 1;
/*
/*
animate / slide to the next or to the corresponding
animate / slide to the next or to the corresponding
fieldset. The order of the links in the navigation
fieldset. The order of the links in the navigation
is the order of the fieldsets.
is the order of the fieldsets.
Also, after sliding, we trigger the focus on the first
Also, after sliding, we trigger the focus on the first
input element of the new fieldset
input element of the new fieldset
If we clicked on the last link (confirmation), then we validate
If we clicked on the last link (confirmation), then we validate
all the fieldsets, otherwise we validate the previous one
all the fieldsets, otherwise we validate the previous one
before the form slided
before the form slided
*/
*/
$('#steps').stop().animate({
$('#steps').stop().animate({
marginLeft: '-' + widths[current-1] + 'px'
marginLeft: '-' + widths[current-1] + 'px'
},500,function(){
},500,function(){
if(current == fieldsetCount)
if(current == fieldsetCount)
validateSteps();
validateSteps();
else
else
validateStep(prev);
validateStep(prev);
$('#formElem').children(':nth-child('+ parseInt(current) +')').find(':input:first').focus();
$('#formElem').children(':nth-child('+ parseInt(current) +')').find(':input:first').focus();
});
});
e.preventDefault();
e.preventDefault();
});
});
/*
/*
clicking on the tab (on the last input of each fieldset), makes the form
clicking on the tab (on the last input of each fieldset), makes the form
slide to the next step
slide to the next step
*/
*/
$('#formElem > fieldset').each(function(){
$('#formElem > fieldset').each(function(){
var $fieldset = $(this);
var $fieldset = $(this);
$fieldset.children(':last').find(':input').keydown(function(e){
$fieldset.children(':last').find(':input').keydown(function(e){
if (e.which == 9){
if (e.which == 9){
$('#navigation li:nth-child(' + (parseInt(current)+1) + ') a').click();
$('#navigation li:nth-child(' + (parseInt(current)+1) + ') a').click();
/* force the blur for validation */
/* force the blur for validation */
$(this).blur();
$(this).blur();
e.preventDefault();
e.preventDefault();
}
}
});
});
});
});
/*
/*
validates errors on all the fieldsets
validates errors on all the fieldsets
records if the form has errors in $('#formElem').data()
records if the form has errors in $('#formElem').data()
*/
*/
function validateSteps(){
function validateSteps(){
var FormErrors = false;
var FormErrors = false;
for(var i = 1; i < fieldsetCount; ++i){
for(var i = 1; i < fieldsetCount; ++i){
var error = validateStep(i);
var error = validateStep(i);
if(error == -1)
if(error == -1)
FormErrors = true;
FormErrors = true;
}
}
$('#formElem').data('errors',FormErrors);
$('#formElem').data('errors',FormErrors);
}
}
/*
/*
validates one fieldset
validates one fieldset
and returns -1 if errors found, or 1 if not
and returns -1 if errors found, or 1 if not
*/
*/
function validateStep(step){
function validateStep(step){
if(step == fieldsetCount) return;
if(step == fieldsetCount) return;
var error = 1;
var error = 1;
var hasError = false;
var hasError = false;
$('#formElem').children(':nth-child('+ parseInt(step) +')').find(':input:not(button)').each(function(){
$('#formElem').children(':nth-child('+ parseInt(step) +')').find(':input:not(button)').each(function(){
var $this = $(this);
var $this = $(this);
var valueLength = jQuery.trim($this.val()).length;
var valueLength = jQuery.trim($this.val()).length;
if(valueLength == ''){
if(valueLength == ''){
hasError = true;
hasError = true;
$this.css('background-color','#FFEDEF');
$this.css('background-color','#FFEDEF');
}
}
else
else
$this.css('background-color','#FFFFFF');
$this.css('background-color','#FFFFFF');
});
});
var $link = $('#navigation li:nth-child(' + parseInt(step) + ') a');
var $link = $('#navigation li:nth-child(' + parseInt(step) + ') a');
$link.parent().find('.error,.checked').remove();
$link.parent().find('.error,.checked').remove();
var valclass = 'checked';
var valclass = 'checked';
if(hasError){
if(hasError){
error = -1;
error = -1;
valclass = 'error';
valclass = 'error';
}
}
$('<span class="'+valclass+'"></span>').insertAfter($link);
$('<span class="'+valclass+'"></span>').insertAfter($link);
return error;
return error;
}
}
/*
/*
if there are errors don't allow the user to submit
if there are errors don't allow the user to submit
*/
*/
$('#registerButton').bind('click',function(){
$('#registerButton').bind('click',function(){
if($('#formElem').data('errors')){
if($('#formElem').data('errors')){
alert('Please correct the errors in the Form');
alert('Please correct the errors in the Form');
return false;
return false;
}
}
});
});
});?
});
</script>
});//]]>
</head>
<body>
</script>
<div id="content">
</head>
<body>
<div id="content">
<h1>Marve'</h1>
<h1>Marve'</h1>
<div id="wrapper">
<div id="wrapper">
<div id="steps">
<div id="steps">
<form id="formElem" name="formElem" action="" method="post">
<form id="formElem" name="formElem" action="" method="post">
<fieldset class="step">
<fieldset class="step">
<legend>Account</legend>
<legend>Account</legend>
<p>
<p>
<label for="username">User name</label>
<label for="username">User name</label>
<input id="username" name="username" />
<input id="username" name="username" />
</p>
</p>
<p>
<p>
<label for="email">Email</label>
<label for="email">Email</label>
<input id="email" name="email" placeholder="info@helloworld.net" type="email" />
<input id="email" name="email" placeholder="info@helloworld.net" type="email" />
</p>
</p>
<p>
<p>
<label for="password">Password</label>
<label for="password">Password</label>
<input id="password" name="password" type="password" A />
<input id="password" name="password" type="password" A />
</p>
</p>
</fieldset>
</fieldset>
<fieldset class="step">
<fieldset class="step">
<legend>Confirm</legend>
<legend>Confirm</legend>
<p>
<p>
Double check and make sure all information is correct and valid.
Double check and make sure all information is correct and valid.
</p>
</p>
<p class="submit">
<p class="submit">
<button id="registerButton" type="submit">Register</button>
<button id="registerButton" type="submit">Register</button>
</p>
</p>
</fieldset>
</fieldset>
</form>
</form>
</div>
</div>
<div id="navigation" style="display:none;">
<div id="navigation" style="display:none;">
<ul>
<ul>
<li class="selected">
<li class="selected">
<a href="#">Account</a>
<a href="#">Account</a>
</li>
</li>
<li>
<li>
<a href="#">Confirm</a>
<a href="#">Confirm</a>
</li>
</li>
</ul>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
</body>
</html>