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="savings-calculator">
	<div class="container">

	<div class="row">

		<div class="col-12">
			<div id="sc-title">
				<div>
					<h1>Savings Calculator</h1>
					<p>Enter your current rent below to find out just how much you could save by living at our apartments!</p>						
				</div>
			</div> 
		</div> 


	</div> 
	<div class="row">
		<div class="col-md-6">
			<div id="calc-left">
				<div>
					<div class="field-section">
						<h4>What is your current monthly rent?</h4>
						<p class="sm-description">(Without Utilities)</p>
						<div class="text-field"><span class="dollar-sign">$</span><input id="old-rent" class="dollar-field" type="number" value="1000"></div>
						<p class="sm-description">Est. cost of moving: $<span id="moving">245</span></p>
					</div>
					<div class="field-section">
						<div><input id="has-furniture" type="checkbox"> I need furniture.</div>
						<div id="furniture-hide" style="display: none;">
							<p class="sm-description">You’re in luck! We offer furniture packages for just $<span id="furniture">20</span>/month.</p>
						</div>
					</div>
					<div class="field-section">
						<div><input id="has-pet" type="checkbox"> I have a pet.</div>
						<div id="pet-hide" style="display: none;">
							<p class="sm-description">What is your current monthly pet fee?</p>
							<div class="text-field"><span class="dollar-sign">$</span><input id="pet-fee" class="dollar-field" type="number"></div>
						</div>
					</div></div>
			</div> <div>


			<div class="et_pb_text_inner"><span id="calculate-button"><i class="fa fa-calculator"></i> Calculate</span></div>
			</div> 
		</div> <div class="col-md-6">


		<div id="calculator-results">


			<div><h4>You could save an estimated</h4>
				<h2>$<span id="monthly-savings">581</span>/month</h2>
				<h4>by living at our apartments!</h4>
				<h3 class="yearly">That’s a savings of <span class="yearly-result">$<span id="yearly-savings">6972</span></span> per year!</h3></div>
		</div> <div id="calculator-results-negative" style="display: none;">


		<div>
			<h3>Looks like you’re already getting a great deal! We’re actually kind of jealous.</h3>
			<p>We’d still love for you to live here. Check out our <a href="#">floor plans</a> and <a href="#">amenities</a> to learn more.</p></div>
		</div> 
		</div> 


	</div> <div class="row">
	<div class="col-12">


		<div id="calc-disclaimer">


			<div>Savings calculated from base rental rate on a four-bedroom unit. Moving cost estimated from <a style="color: #fff;" href="http://www.gotmovers.com/MOVING_RATES" target="_blank" rel="noopener noreferrer">GotMovers.com</a>. All values are estimates and subject to change. Contact the office for current rates and specials.</div>
		</div> 
	</div> 


	</div> 

	</div>
</div>
              
            
!

CSS

              
                body {
	margin: 0;
}

div {
	font-family: sans-serif;
	color: #fff;
}

h1 {
	font-weight: 900;
}

#calculate-button {
	margin-bottom: 35px;
}

/* SAVINGS CALCULATOR
-------------------------------------------------------*/

#calculator-results {
	padding: 20px;
	border: solid 1px rgba(255,255,255,0.3);
	border-radius: 4px;
}

#calculator-results-negative h3 {
	font-weight: 700;
}

#calculator-results-negative a {
	color:#fff;
	opacity: 0.7;
	font-weight: 700;
}

#calculator-results-negative a:hover {
	opacity: 1;
}

#sc-title {
	margin-bottom: 45px;
}

#savings-calculator {
	background: #2e1e33;
	background: -moz-linear-gradient(left, #2e1e33 14%, #503859 100%);
	background: -webkit-linear-gradient(left, #2e1e33 14%,#503859 100%);
	background: linear-gradient(to right, #2e1e33 14%,#503859 100%);
	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2e1e33', endColorstr='#503859',GradientType=1 );
	padding: 50px 35px 80px 35px;
}

#savings-calculator .field-section {
	margin-bottom: 15px;
}

#savings-calculator h4, #savings-calculator p {
	padding-bottom: 0;
}

#savings-calculator .title-section h1 {
	font-weight: 700;
	font-size: 42px;
}

#savings-calculator .title-section p {
	font-size: 18px;
}

.sm-description {
	font-size: 13px;
	opacity: 0.8;
}

.text-field {
	display: inline-block;
	box-shadow: 0 6px 18px -4px rgba(0,0,0,0.4);
}

.dollar-sign, .dollar-field {
	font-size: 18px;
	line-height: 1em;
	padding:10px;
	border: 0;
}

.dollar-sign {
	background:#53b7b9;
	padding:10px 20px;
	font-weight: 700;
}

#pet-fee {
	width:150px;
}

#calculate-button {
	display: inline-block;
	padding:20px 35px;
	line-height: 1.3em;
	border-radius: 3px;
	background-color: #53b7b9;
	text-transform: uppercase;
	font-weight: 700;
	letter-spacing: 1px;
	cursor: pointer;
	transition: all ease 0.18s;
	position: relative;
	font-size: 20px;
	box-shadow: 0 6px 15px -1px rgba(0,0,0,0.3);
	width: 100%;
	max-width: 300px;
	text-align: center;
}

#calculate-button:hover {
	background-color: #fff;
	color: #333!important;
}

/* #calculate-button:before {
content: "\e0e7";
font-family: 'ETmodules';
margin-right: 10px;
}

#calculate-button:after {
content:"\e052";
font-family: 'ETmodules';
position: absolute;
right:-40px;
font-size: 25px;
transform: scale(0.8);
opacity: 0;
} */

#calculate-button:after, #calculate-button:hover::after {
	color:#97eb90!important;
	background:none;
	background-color: transparent;
}

#calculate-button.animate:after {
	animation: fadeInScale 1.2s ease-out 1;
	animation-fill-mode: forwards;
}

@keyframes fadeInScale {
	0% {
		transform: scale(0.8);
		opacity: 0;
	}

	10% {
		transform: scale(1.0);
		opacity: 1;
	}

	90% {
		transform: scale(1.0);
		opacity: 1;
	}

	100% {
		transform: scale(0.8);
		opacity: 0;
	}
}

#calculator-results h2 {
	font-size: 60px;
	max-width: 550px;
	font-weight: 700;
	color: #53b7b9!important;
	line-height: 1.3em;
}

#calculator-results h3 {
	font-weight: 700;
	margin-top: 25px;
	font-size: 17px;
}

#calc-disclaimer {
	margin-top: 45px;
}

#calc-disclaimer {
	font-size: 10px;
	line-height: 1.3em;
	opacity: 0.6;
	text-align: center;
	display: block;
	margin-left: auto;
	margin-right: auto;
	max-width: 650px;
}

#calc-disclaimer a {
	text-decoration: underline;
}

#calculator-results .yearly {
	font-size: 35px;
}

#calculator-results .yearly-result {
	color:#53b7b9;
}

@media only screen and (max-width:768px) {
	#calculator-results h2 {
		font-size:30px;
	}
}
              
            
!

JS

              
                var newRent = 399;
    var movingCost = 245;
	var furnitureCost = 240;
    var furnitureCostMonthly = furnitureCost/12;
    var newPet = 25;
	jQuery(document).ready(Setup);
	function Setup() {
		jQuery("#has-furniture").click(function (event) { 
			jQuery("#furniture-hide").toggle(event.target.checked);
			Calculate();
		 });
		jQuery("#has-pet").click(function (event) {
			jQuery("#pet-hide").toggle(event.target.checked);
			Calculate();
		});
		jQuery("#old-rent").blur(Calculate);
        jQuery("#pet-fee").blur(Calculate);
        
        jQuery("#new-rent").text(newRent.toFixed(0)) //.blur(Calculate);
		jQuery("#moving").text(movingCost.toFixed(0)); //.blur(Calculate);
		jQuery("#furniture").text(furnitureCostMonthly.toFixed(0)); //.blur(Calculate);

		jQuery("#furniture-hide").hide();
		jQuery("#pet-hide").hide();
		Calculate();
	}
    
	function Calculate() {
		var monthly = MonthlySavings(
			+jQuery("#old-rent").val(),
			newRent,
			movingCost, // +jQuery("#moving").val(),
			jQuery("#has-furniture").prop("checked"),
			furnitureCost, // +jQuery("#furniture").val(),
			jQuery("#has-pet").prop("checked"),
			+jQuery("#pet-fee").val(),
			newPet
		).toFixed(0);
		var annual = YearlySavings(monthly).toFixed(0);
		
		if (monthly > 0) {
            jQuery("#calculator-results").show();
            jQuery("#calculator-results-negative").hide();
            jQuery("#monthly-savings").text(monthly);
            jQuery("#yearly-savings").text(annual);   
        } else {
            jQuery("#calculator-results").hide();
            jQuery("#calculator-results-negative").show();
        };
	}
    
	function MonthlySavings(competitor, property, moving, hasFurniture, furniture, hasPet, pet, newPet) {
		var f = (hasFurniture 
                ? (furniture / 12) 
                : 0);
		var p = (hasPet ? pet : 0);
        var np = (hasPet ? newPet : 0);
		return (
			competitor +
			p
		) - (
			property +
            f + 
			np + 
			(moving / 12)
		);
	}

	function YearlySavings(monthly) {
		return monthly * 12;
	}
    
    jQuery("#calculate-button").click( function() {
        jQuery(this).addClass("animate");
        
        setTimeout(function () { 
            jQuery("#calculate-button").removeClass("animate");
        }, 1200);   
    });
              
            
!
999px

Console