0
У меня эта многоступенчатая форма. Я хочу вставить эту форму в световую коробку. Я понятия не имею, как это сделать. Я много искал, но ничего не нашел, пожалуйста, назовите меня.Multi Step form in lightbox popup
я использовал JQuery и CSS для достижения этой цели
$(document).ready(function(){
//jQuery time
var current_fs, next_fs, previous_fs; //fieldsets
var left, opacity, scale; //fieldset properties which we will animate
var animating; //flag to prevent quick multi-click glitches
$(".next").click(function(){
\t if(animating) return false;
\t animating = true;
\t
\t current_fs = $(this).parent();
\t next_fs = $(this).parent().next();
\t
\t //activate next step on progressbar using the index of next_fs
\t $("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
\t
\t //show the next fieldset
\t next_fs.show();
\t //hide the current fieldset with style
\t current_fs.animate({opacity: 0}, {
\t \t step: function(now, mx) {
\t \t \t //as the opacity of current_fs reduces to 0 - stored in "now"
\t \t \t //1. scale current_fs down to 80%
\t \t \t scale = 1 - (1 - now) * 0.2;
\t \t \t //2. bring next_fs from the right(50%)
\t \t \t left = (now * 50)+"%";
\t \t \t //3. increase opacity of next_fs to 1 as it moves in
\t \t \t opacity = 1 - now;
\t \t \t current_fs.css({'transform': 'scale('+scale+')'});
\t \t \t next_fs.css({'left': left, 'opacity': opacity});
\t \t },
\t \t duration: 800,
\t \t complete: function(){
\t \t \t current_fs.hide();
\t \t \t animating = false;
\t \t },
\t \t //this comes from the custom easing plugin
\t \t easing: 'easeInOutBack'
\t });
});
$(".previous").click(function(){
\t if(animating) return false;
\t animating = true;
\t
\t current_fs = $(this).parent();
\t previous_fs = $(this).parent().prev();
\t
\t //de-activate current step on progressbar
\t $("#progressbar li").eq($("fieldset").index(current_fs)).removeClass("active");
\t
\t //show the previous fieldset
\t previous_fs.show();
\t //hide the current fieldset with style
\t current_fs.animate({opacity: 0}, {
\t \t step: function(now, mx) {
\t \t \t //as the opacity of current_fs reduces to 0 - stored in "now"
\t \t \t //1. scale previous_fs from 80% to 100%
\t \t \t scale = 0.8 + (1 - now) * 0.2;
\t \t \t //2. take current_fs to the right(50%) - from 0%
\t \t \t left = ((1-now) * 50)+"%";
\t \t \t //3. increase opacity of previous_fs to 1 as it moves in
\t \t \t opacity = 1 - now;
\t \t \t current_fs.css({'left': left});
\t \t \t previous_fs.css({'transform': 'scale('+scale+')', 'opacity': opacity});
\t \t },
\t \t duration: 800,
\t \t complete: function(){
\t \t \t current_fs.hide();
\t \t \t animating = false;
\t \t },
\t \t //this comes from the custom easing plugin
\t \t easing: 'easeInOutBack'
\t });
});
$(".submit").click(function(){
\t return false;
})
});
/*custom font*/
@import url(http://fonts.googleapis.com/css?family=Montserrat);
/*basic reset*/
* {margin: 0; padding: 0;}
html {
\t height: 100%;
\t /*Image only BG fallback*/
\t background: url('http://thecodeplayer.com/uploads/media/gs.png');
\t /*background = gradient + image pattern combo*/
\t background:
\t \t linear-gradient(rgba(196, 102, 0, 0.2), rgba(155, 89, 182, 0.2)),
\t \t url('http://thecodeplayer.com/uploads/media/gs.png');
}
body {
\t font-family: montserrat, arial, verdana;
}
/*form styles*/
#msform {
\t width: 400px;
\t margin: 50px auto;
\t text-align: center;
\t position: relative;
}
#msform fieldset {
\t background: white;
\t border: 0 none;
\t border-radius: 3px;
\t box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4);
\t padding: 20px 30px;
\t
\t box-sizing: border-box;
\t width: 80%;
\t margin: 0 10%;
\t
\t /*stacking fieldsets above each other*/
\t position: absolute;
}
/*Hide all except first fieldset*/
#msform fieldset:not(:first-of-type) {
\t display: none;
}
/*inputs*/
#msform input, #msform textarea {
\t padding: 15px;
\t border: 1px solid #ccc;
\t border-radius: 3px;
\t margin-bottom: 10px;
\t width: 100%;
\t box-sizing: border-box;
\t font-family: montserrat;
\t color: #2C3E50;
\t font-size: 13px;
}
/*buttons*/
#msform .action-button {
\t width: 100px;
\t background: #27AE60;
\t font-weight: bold;
\t color: white;
\t border: 0 none;
\t border-radius: 1px;
\t cursor: pointer;
\t padding: 10px 5px;
\t margin: 10px 5px;
}
#msform .action-button:hover, #msform .action-button:focus {
\t box-shadow: 0 0 0 2px white, 0 0 0 3px #27AE60;
}
/*headings*/
.fs-title {
\t font-size: 15px;
\t text-transform: uppercase;
\t color: #2C3E50;
\t margin-bottom: 10px;
}
.fs-subtitle {
\t font-weight: normal;
\t font-size: 13px;
\t color: #666;
\t margin-bottom: 20px;
}
/*progressbar*/
#progressbar {
\t margin-bottom: 30px;
\t overflow: hidden;
\t /*CSS counters to number the steps*/
\t counter-reset: step;
}
#progressbar li {
\t list-style-type: none;
\t color: white;
\t text-transform: uppercase;
\t font-size: 9px;
\t width: 33.33%;
\t float: left;
\t position: relative;
}
#progressbar li:before {
\t content: counter(step);
\t counter-increment: step;
\t width: 20px;
\t line-height: 20px;
\t display: block;
\t font-size: 10px;
\t color: #333;
\t background: white;
\t border-radius: 3px;
\t margin: 0 auto 5px auto;
}
/*progressbar connectors*/
#progressbar li:after {
\t content: '';
\t width: 100%;
\t height: 2px;
\t background: white;
\t position: absolute;
\t left: -50%;
\t top: 9px;
\t z-index: -1; /*put it behind the numbers*/
}
#progressbar li:first-child:after {
\t /*connector not needed before the first step*/
\t content: none;
}
/*marking active/completed steps green*/
/*The number of the step and the connector before it = green*/
#progressbar li.active:before, #progressbar li.active:after{
\t background: #27AE60;
\t color: white;
}
<!doctype html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</head>
<!-- multistep form -->
<body>
<form id="msform">
\t <!-- progressbar -->
\t <ul id="progressbar">
\t \t <li class="active">Account Setup</li>
\t \t <li>Social Profiles</li>
\t \t <li>Personal Details</li>
\t </ul>
\t <!-- fieldsets -->
\t <fieldset>
\t \t <h2 class="fs-title">Create your account</h2>
\t \t <h3 class="fs-subtitle">This is step 1</h3>
\t \t <input type="text" name="email" placeholder="Email" />
\t \t <input type="password" name="pass" placeholder="Password" />
\t \t <input type="password" name="cpass" placeholder="Confirm Password" />
\t \t <input type="button" name="next" class="next action-button" value="Next" />
\t </fieldset>
\t <fieldset>
\t \t <h2 class="fs-title">Social Profiles</h2>
\t \t <h3 class="fs-subtitle">Your presence on the social network</h3>
\t \t <input type="text" name="twitter" placeholder="Twitter" />
\t \t <input type="text" name="facebook" placeholder="Facebook" />
\t \t <input type="text" name="gplus" placeholder="Google Plus" />
\t \t <input type="button" name="previous" class="previous action-button" value="Previous" />
\t \t <input type="button" name="next" class="next action-button" value="Next" />
\t </fieldset>
\t <fieldset>
\t \t <h2 class="fs-title">Personal Details</h2>
\t \t <h3 class="fs-subtitle">We will never sell it</h3>
\t \t <input type="text" name="fname" placeholder="First Name" />
\t \t <input type="text" name="lname" placeholder="Last Name" />
\t \t <input type="text" name="phone" placeholder="Phone" />
\t \t <textarea name="address" placeholder="Address"></textarea>
\t \t <input type="button" name="previous" class="previous action-button" value="Previous" />
\t \t <input type="submit" name="submit" class="submit action-button" value="Submit" />
\t </fieldset>
</form>
<!-- jQuery -->
<script src="http://thecodeplayer.com/uploads/js/jquery-1.9.1.min.js" type="text/javascript"></script>
<!-- jQuery easing plugin -->
<script src="http://thecodeplayer.com/uploads/js/jquery.easing.min.js" type="text/javascript"></script>
</body>
</html>