사용자가 패키지를 클릭하여 다음 단계로 넘어갈 때 어떻게 만들 수 있습니까? 하단의 버튼을 클릭하지 않아도됩니다. 또한 그들이 선택한 패키지를 아는 방법이 있습니까?슬라이더 양식 질문
현재이 링크가 있습니다. 다음은
http://www.prototypesyndicate.com/_forms/marketing_packages.html
는<div id="wrapper">
<div id="steps">
<form id="formElem" name="formElem" action="../send_marketing.php" method="post">
<fieldset class="step">
<legend>Select a Marketing Package</legend>
<!--**************************** PACKAGES ****************************-->
<div class="grid" id="griddler_ii">
<div class="sections col3">
<div>
<article class="first">
<header>
<hgroup class="plan"><h1>Student</h1></hgroup>
<hgroup class="price"><h2>$10<em>Monthly</em></h2></hgroup>
</header>
<section>
<ul>
<li>$20</li>
<li>4.0%</li>
<li>400</li>
<li>100MB</li>
<li>500GB</li>
<li> </li>
</ul>
</section>
<footer>
<a class="button" href="#"><span>Choose Plan</span></a></li>
</footer>
</article>
<article class="selected">
<header>
<hgroup class="plan"><h1>Professional</h1></hgroup>
<hgroup class="price"><h2>$20<em>Monthly</em></h2><h4 class="label">Best value</h4></hgroup>
</header>
<section>
<ul>
<li>Waived</li>
<li>3.0%</li>
<li class="tooltip-holder">1000
<div class="tooltip">
<div>
<h3>Available Space</h3>
<p>Duis volutpat nisl ac ante pulvinar non lobortis urna adipiscing. In hac habitasse platea dictumst. </p>
</div>
</div></li>
<li class="tooltip-holder">400MB
<div class="tooltip">
<div>
<h3>Available Space</h3>
<p>Duis volutpat nisl ac ante pulvinar non lobortis urna adipiscing. In hac habitasse platea dictumst. </p>
</div>
</div></li>
<li class="tooltip-holder">1000
<div class="tooltip">
<div>
<h3>Available Space</h3>
<p>Duis volutpat nisl ac ante pulvinar non lobortis urna adipiscing. In hac habitasse platea dictumst. </p>
</div>
</div>
</li>
<li><span class="check">Yes</span></li>
</ul>
</section>
<footer>
<a class="button" href="#"><span>Choose Plan</span></a>
</footer>
</article>
<article class="last">
<header>
<hgroup class="plan"><h1>Premium</h1></hgroup>
<hgroup class="price"><h2>$40<em>Monthly</em></h2></hgroup>
</header>
<section>
<ul>
<li>Waived</li>
<li>1.0%</li>
<li>Unlimited</li>
<li>10GB</li>
<li>Unlimited</li>
<li><span class="check">Yes</span></li>
</ul>
</section>
<footer>
<a class="button" href="#"><span>Choose Plan</span></a>
</footer>
</article>
</div>
</div>
</div>
<!--[if IE 8]>
<script type="text/javascript">
$("#griddler_ii section ul li:nth-child(even)").addClass("even");
</script>
<![endif]-->
<!--**************************** PACKAGES: END ****************************-->
</fieldset>
<fieldset class="step">
<legend class="tight">Provide Your Contact Information</legend>
<p class="column2">
<label for="updates">Tell Us About Yourself?<br>(Your industry, about your customers, where you are based)</label>
<textarea name="description" rows="7" cols="20"></textarea>
</p>
<p>
<label for="name">Name*:</label>
<input id="name" name="name" type="text" AUTOCOMPLETE=OFF class="required" />
</p>
<p>
<label for="company">Company:</label>
<input id="company" name="company" type="text" AUTOCOMPLETE=OFF />
</p>
<p>
<label for="website">Email*:</label>
<input id="website" name="email" placeholder="e.g. [email protected]" type="text" AUTOCOMPLETE=OFF class="required" />
</p>
<p>
<label for="website">Website:</label>
<input id="website" name="website" type="text" AUTOCOMPLETE=ON />
</p>
<p>
<label for="phone">Phone*:</label>
<input id="phone" name="phone" placeholder="e.g. +351215555555" type="tel" AUTOCOMPLETE=OFF class="required" />
</p>
</fieldset>
<fieldset class="step">
<br/><br/><br/><br/>
<p class="review">
If all required fields in the form are correctly filled a green checkmark will appear. A red checkmark indicates that some required field is missing or filled out with invalid data.
</p>
<p class="submit">
<button id="registerButton" type="submit">Let’s Begin</button>
</p>
</fieldset>
</form>
</div>
<div id="navigation" style="display:none;">
<ul>
<li>
<a href="#">Select a Packages</a>
</li>
<li>
<a href="#">Provide your Contact</a>
</li>
<li>
<a href="#">Let's Begin</a>
</li>
</ul>
</div>
</div>
JAVASCRIPT 당신은 하단 탭의 슬라이드를 수행하는 코드의 일부를 볼 필요가
$(function() {
/*
number of fieldsets
*/
var fieldsetCount = $('#formElem').children().length;
/*
current position of fieldset/navigation link
*/
var current = 1;
/*
sum and save the widths of each one of the fieldsets
set the final sum as the total width of the steps element
*/
var stepsWidth = 0;
var widths = new Array();
$('#steps .step').each(function(i){
var $step = $(this);
widths[i] = stepsWidth;
stepsWidth += $step.width();
});
$('#steps').width(stepsWidth);
/*
to avoid problems in IE, focus the first input of the form
*/
$('#formElem').children(':first').find(':input:first').focus();
/*
show the navigation bar
*/
$('#navigation').show();
/*
when clicking on a navigation link
the form slides to the corresponding fieldset
*/
$('#navigation a').bind('click',function(e){
var $this = $(this);
var prev = current;
$this.closest('ul').find('li').removeClass('selected');
$this.parent().addClass('selected');
/*
we store the position of the link
in the current variable
*/
current = $this.parent().index() + 1;
/*
animate/slide to the next or to the corresponding
fieldset. The order of the links in the navigation
is the order of the fieldsets.
Also, after sliding, we trigger the focus on the first
input element of the new fieldset
If we clicked on the last link (confirmation), then we validate
all the fieldsets, otherwise we validate the previous one
before the form slided
*/
$('#steps').stop().animate({
marginLeft: '-' + widths[current-1] + 'px'
},500,function(){
if(current == fieldsetCount)
validateSteps();
else
validateStep(prev);
$('#formElem').children(':nth-child('+ parseInt(current) +')').find(':input:first').focus();
});
e.preventDefault();
});
/*
clicking on the tab (on the last input of each fieldset), makes the form
slide to the next step
*/
$('#formElem > fieldset').each(function(){
var $fieldset = $(this);
$fieldset.children(':last').find(':input').keydown(function(e){
if (e.which == 9){
$('#navigation li:nth-child(' + (parseInt(current)+1) + ') a').click();
/* force the blur for validation */
$(this).blur();
e.preventDefault();
}
});
});
/*
validates errors on all the fieldsets
records if the Form has errors in $('#formElem').data()
*/
function validateSteps(){
var FormErrors = false;
for(var i = 1; i < fieldsetCount; ++i){
var error = validateStep(i);
if(error == -1)
FormErrors = true;
}
$('#formElem').data('errors',FormErrors);
}
/*
validates one fieldset
and returns -1 if errors found, or 1 if not
*/
function validateStep(step){
if(step == fieldsetCount) return;
var error = 1;
var hasError = false;
$('#formElem').children(':nth-child('+ parseInt(step) +')').find(':input.required:not(button)').each(function(){
var $this = $(this);
var valueLength = jQuery.trim($this.val()).length;
if(valueLength == ''){
hasError = true;
$this.css('background-color','#333333');
}
else
$this.css('background-color','#000000');
});
var $link = $('#navigation li:nth-child(' + parseInt(step) + ') a');
$link.parent().find('.error,.checked').remove();
var valclass = 'checked';
if(hasError){
error = -1;
valclass = 'error';
}
$('<span class="'+valclass+'"></span>').insertAfter($link);
return error;
}
/*
if there are errors don't allow the user to submit
*/
$('#registerButton').bind('click',function(){
if($('#formElem').data('errors')){
alert('Please correct the errors in the Form');
return false;
}
});
});
정확하게 슬라이드하려는 부분은 무엇입니까? – Zlatev
예를 들어 맨 아래에서 연락처 제공을 클릭하면 다음 단계로 넘어갑니다. 기본적으로 패키지를 클릭하면 다음 단계로 넘어갑니다. @ Zlatev – Alex