Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

Save Automatically?

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="calculator-wrapper">
  <div id="calculator-form">
    <h2>Screen Size Calculator</h2>
    
<!--     <div class="input-field field-metric">
      <label id="metric-attendees" class="active">Attendees</label>
      <label id="metric-budget">Budget</label>
    </div> -->
    
    <div class="input-field field-attendees">
      <label>Approximately how many attendees will you have?</label> 
      <input type="range" id="attendees" name="attendees" 
         min="25" max="2500" value="25" step="25">
      <span id="range-value">25</span>
    </div>
    
    <div class="input-field field-budget" style="display: none;">
      <label>What is your budget?</label> 
      <input type="range" id="budget" name="budget" 
         min="25" max="2500" value="25" step="25">
      <span id="range-value">25</span>
    </div>

    <div class="input-field field-weekday">
      <label>What Day of The Week Do You Need Your Screen?</label>
      <select id="weekday">
        <option value="Sun-Wed">Sun-Wed</option>
        <option value="Thu-Sat">Thu-Sat</option> 
      </select>
    </div>
  </div>

  <div id="calculator-results">
    <h3>Recommended Screen Size: <span id="results-size">10x7 feet</span></h3>
    <p><strong>Price:</strong> <span id="price-wrapper">Starting at $<span id="results-price">299</span></span></p>
    <div class="visualization">
      <div id="person"><img src="https://www.uoe.com/wp-content/uploads/2019/03/people-dark.png"></div>
      <div id="screen-visual" class="a25">10x7 feet</div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                body {
  font-family: sans-serif;
}

/* --- Screen Size Calculator --- */

#calculator-wrapper {
	border: solid 6px #d62726;
	background: #ffffff;
	border-radius: 8px;
}

#calculator-form {
	background: #d62826;
	padding: 30px;
}

#calculator-wrapper h2, #calculator-wrapper label, #range-value {
	color: #fff;
}

#range-value {
	font-weight: 700;
}

@media only screen and (min-width:990px) {
	#calculator-wrapper {
		display: grid;
		grid-template-columns: 1fr 2fr;
		grid-gap: 0;
	}
}

#calculator-wrapper .logo {
  max-width: 270px;
}

#calculator-wrapper h2 {
  font-size: 40px;
	margin-bottom: 15px;
  margin-top: 0px;
}

#calculator-wrapper label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
}

#calculator-wrapper .input-field {
  margin-bottom: 15px;
}

#calculator-wrapper button {
  padding: 15px 30px;
  border-radius: 4px;
  color: #fff;
  background: #D93332;
  border: none;
  cursor: pointer;
  font-size: 25px;
}

#calculator-wrapper select {
  height: 40px;
  width: 180px;
  font-size: 15px;
	border-radius: 4px;
}

#calculator-results {
  padding: 30px 25px;
}

#attendees {
	width: 350px;
	-webkit-appearance: none;
	height: 10px;
	border-radius: 10px;
	background: #111;
	outline: none;
	opacity: 1;
	width: 100%;
	padding: 0px 10px;
  box-sizing: border-box;
}

#attendees::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 25px;
  height: 25px;
  background: #D93332;
	border: solid 3px #fff;
  cursor: pointer;
  border-radius: 50%;
	box-shadow: 0 5px 12px -2px rgba(0,0,0,0.3);
}

#attendees::-moz-range-thumb {
  width: 25px;
  height: 25px;
  background: #4CAF50;
  cursor: pointer;
}

#calculator-wrapper .visualization {
  display: flex;
}

#screen-visual {
  width: 100px;
  height: 70px;
  border: solid 8px #444;
  border-radius: 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: all ease 0.4s;
  border-bottom-width: 22px;
  border-right-width: 10px;
  border-left-width: 10px;
  position: relative;
  font-weight: 700;
  color: #444;
  max-width: 100%;
  background: #ccc;
	box-shadow: inset 0px 0px 15px rgba(0,0,0,0.4);
}

#screen-visual::before, #screen-visual::after {
  content: "";
  position: absolute;
  bottom: -14px;
  right: 5px;
  width: 20px;
  height: 7px;
  background: #ccc;
  z-index: 999;
  border-radius: 50px;
}

#screen-visual::before {
	right: -13%;
	bottom: -27px;
	z-index: 0;
	width: 126%;
	background: black;
	border-radius: 50%;
	opacity: 0.2;
	height: 11px;
}

#screen-visual::after {
	width: 22px;
	right: 0;
}

#person {
  display: inline;
  align-self: flex-end;
  margin-right: 10px;
}
#person img {
  max-height: 70px;
  width: auto;
  height: 100%;
}

#screen-visual.a25 {
  width: 100px;
  height: 70px;
}

#screen-visual.a75 {
  width: 120px;
  height: 90px;
}

#screen-visual.a250 {
  width: 160px;
  height: 90px;
}

#screen-visual.a500 {
  width: 200px;
  height: 120px;
}

#screen-visual.a750 {
  width: 260px;
  height: 150px;
}

#screen-visual.a1000 {
  width: 300px;
  height: 170px;
}

#screen-visual.a2500 {
  width: 400px;
  height: 200px;
}

#screen-visual.a5000 {
  width: 520px;
  height: 260px;
}

#results-size, #price-wrapper {
	color: red;
}

#weekday {
	color: black;
	font-weight: 600;
}

@media only screen and (max-width:990px) {
	#person {
		display:none;
	}
}

#calculator-wrapper .input-field.field-metric {
  display: flex;
  margin-bottom: 10px;
}

#calculator-wrapper .input-field.field-metric label {
  font-weight: 500;
  cursor: pointer;
  opacity: 0.7;
  display: inline-block;
  padding: 5px 0;
  margin-right: 10px;
}

#calculator-wrapper .input-field.field-metric label.active {
  font-weight: 700;
  border-bottom: solid 3px #fff;
  opacity: 1;
}
              
            
!

JS

              
                
jQuery(document).ready(function() {

  // Prices
  var low25 = 299
  var high25 = 349
  var low75 = 349
  var high75 = 399
  var low250 = 599
  var high250 = 649
  var low500 = 799
  var high500 = 899
  var low750 = 1199
  var high750 = 1399
  var low1000 = 1899
  var high1000 = 2099
  var low2500 = 2399
  var high2500 = 2599
  var low5000 = 3499
  var high5000 = 3999

  // Screen Sizes
  var size25 = '10x7 feet'
  var size75 = '12x9 feet'
  var size250 = '16x9 feet'
  var size500 = '20x12 feet'
  var size750 = '26x15 feet'
  var size1000 = '30x17 feet'
  var size2500 = '40x20 feet'
  var size5000 = '52x26 feet'

  // Regex function plugin to add commas to numbers
  jQuery.fn.digits = function(){
    return this.each(function(){
      jQuery(this).text( jQuery(this).text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,") );
    })
  }

  // Adjust range number when changed
  jQuery('input[type=range]').on('input', function () {

    // Get number of attendees in range slider
    var attendeeNumber = jQuery('#attendees').val();

    // Insert number of attendees in span
    jQuery('#range-value').text(attendeeNumber);

    // Add plus sign if it reaches 2500
    if( attendeeNumber > 2499) {
      jQuery('#range-value').append('+');
    }

    // Add commas to number
    jQuery('#range-value').digits();
  });

  // Calculator
  function generate() {

    // Input Values
    var attendeeNumber = jQuery('#attendees').val();
    var weekDay = jQuery('#weekday').val();

    // Determine price - low
    if( weekDay === 'Sun-Wed') {
      if( (attendeeNumber <= 25) ) {
        jQuery('#results-price').text(low25);
        jQuery('#results-size').text(size25);
        jQuery('#screen-visual').text(size25);
        jQuery('#screen-visual').removeClass().addClass('a25');
      }

      if( (attendeeNumber > 25) && (attendeeNumber <= 75) ) {
        jQuery('#results-price').text(low75);
        jQuery('#results-size').text(size75);
        jQuery('#screen-visual').text(size75);
        jQuery('#screen-visual').removeClass().addClass('a75');
      }

      if( (attendeeNumber > 75) && (attendeeNumber <= 250) ) {
        jQuery('#results-price').text(low250);
        jQuery('#results-size').text(size250);
        jQuery('#screen-visual').text(size250);
        jQuery('#screen-visual').removeClass().addClass('a250');
      }

      if( (attendeeNumber > 250) && (attendeeNumber <= 500) ) {
        jQuery('#results-price').text(low500);
        jQuery('#results-size').text(size500);
        jQuery('#screen-visual').text(size500);
        jQuery('#screen-visual').removeClass().addClass('a500');
      }

      if( (attendeeNumber > 500) && (attendeeNumber <= 750) ) {
        jQuery('#results-price').text(low750);
        jQuery('#results-size').text(size750);
        jQuery('#screen-visual').text(size750);
        jQuery('#screen-visual').removeClass().addClass('a750');
      }

      if( (attendeeNumber > 750) && (attendeeNumber <= 1000) ) {
        jQuery('#results-price').text(low1000);
        jQuery('#results-size').text(size1000);
        jQuery('#screen-visual').text(size1000);
        jQuery('#screen-visual').removeClass().addClass('a1000');
      }

      if( (attendeeNumber > 1000) && (attendeeNumber <= 2499) ) {
        jQuery('#results-price').text(low2500);
        jQuery('#results-size').text(size2500);
        jQuery('#screen-visual').text(size2500);
        jQuery('#screen-visual').removeClass().addClass('a2500');
      }

      if( (attendeeNumber >= 2500) ) {
        jQuery('#results-price').text(low5000);
        jQuery('#results-size').text(size5000);
        jQuery('#screen-visual').text(size5000);
        jQuery('#screen-visual').removeClass().addClass('a5000');
      }
    }

    // Determine Price - High
    if( weekDay === 'Thu-Sat') {
      if( (attendeeNumber <= 25) ) {
        jQuery('#results-price').text(high25);
        jQuery('#results-size').text(size25);
        jQuery('#screen-visual').text(size25);
        jQuery('#screen-visual').removeClass().addClass('a25');
      }

      if( (attendeeNumber > 25) && (attendeeNumber <= 75) ) {
        jQuery('#results-price').text(high75);
        jQuery('#results-size').text(size75);
        jQuery('#screen-visual').text(size75);
        jQuery('#screen-visual').removeClass().addClass('a75');
      }

      if( (attendeeNumber > 75) && (attendeeNumber <= 250) ) {
        jQuery('#results-price').text(high250);
        jQuery('#results-size').text(size250);
        jQuery('#screen-visual').text(size250);
        jQuery('#screen-visual').removeClass().addClass('a250');
      }

      if( (attendeeNumber > 250) && (attendeeNumber <= 500) ) {
        jQuery('#results-price').text(high500);
        jQuery('#results-size').text(size500);
        jQuery('#screen-visual').text(size500);
        jQuery('#screen-visual').removeClass().addClass('a500');
      }

      if( (attendeeNumber > 500) && (attendeeNumber <= 750) ) {
        jQuery('#results-price').text(high750);
        jQuery('#results-size').text(size750);
        jQuery('#screen-visual').text(size750);
        jQuery('#screen-visual').removeClass().addClass('a750');
      }

      if( (attendeeNumber > 750) && (attendeeNumber <= 1000) ) {
        jQuery('#results-price').text(high1000);
        jQuery('#results-size').text(size1000);
        jQuery('#screen-visual').text(size1000);
        jQuery('#screen-visual').removeClass().addClass('a1000');
      }

      if( (attendeeNumber > 1000) && (attendeeNumber <= 2499) ) {
        jQuery('#results-price').text(high2500);
        jQuery('#results-size').text(size2500);
        jQuery('#screen-visual').text(size2500);
        jQuery('#screen-visual').removeClass().addClass('a2500');
      }

      if( (attendeeNumber >= 2500) ) {
        jQuery('#results-price').text(high5000);
        jQuery('#results-size').text(size5000);
        jQuery('#screen-visual').text(size5000);
        jQuery('#screen-visual').removeClass().addClass('a5000');
      }
    }

    // Apply comma regex function to price
    jQuery('#results-price').digits();

  }

  // Generate results
  jQuery('input[type=range]').on('input', generate);
  jQuery('select').on('input', generate);

});


              
            
!
999px

Console