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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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

              
                body
  //- div(class="select_box_area")
  //-   p(class="select")
  //-     span(class="placeholder")
  //-       | Select
  //-     em(class="fa fa-angle-down")
  //-   ul(class="filter_list")
  //-     li
  //-       label
  //-         input(type="checkbox")
  //-         | HTML
  //-     li
  //-       label
  //-         input(type="checkbox")
  //-         | jQuery
  //-     li
  //-       label
  //-         input(type="checkbox")
  //-         | Pug
  //-     li
  //-       label
  //-         input(type="checkbox")
  //-         | SASS
  //-     li
  //-       label
  //-         input(type="checkbox")
  //-         | Angular
  
  

  select(class="custom-select")
    - var options = ['HTML', 'jQuery', 'Pug', 'SASS', 'Angular', 'React', 'Jade', 'PHP','Java']
    - for(a = 0; a < options.length; a++ )
      option(value=""+ options[a] +"")= options[a]
      
  
  //- button(type="button" class="console-btn")
  //-   | click to console
    
    
  
              
            
!

CSS

              
                /*---------------
  ---------Variables-------- */

$fontStack-1: 'Montserrat', sans-serif
$color-1: #254375
$color-2: #ffffff

/*---------------
  ---------Global-------- */

html, body
  height: 100%

body
  background: $color-1
  font: 
    family: $fontStack-1
    size: 16px
    weight: 400
  color: $color-2
  position: relative

.select_box_area
  position: relative
  display: inline-block
  // top: 10px
  // left: 50%
  // transform: translateX(-50%)
  
  p
    margin-bottom: 0px
    min-width: 300px
    max-width: 300px
    background: lighten($color-1, 10%)
    padding: 10px 15px
    border: 1px solid rgba($color-2, 0.5)
    line-height: 24px
    padding-right: 30px
    cursor: pointer
    em
      position: absolute
      right: 15px
      top: 13px
      font-size: 20px
      transition: all 0.3s linear
      &.angle-up
        transform: rotate(180deg)
    .option
      position: relative
      display: inline-block
      padding-right: 15px
      &::after
        content: ","
        position: absolute
        right: 5px
        top: 0
      &:last-of-type
        padding-right: 0px
        &::after
          display: none
    
  
.filter_list
  padding: 0px
  background: lighten($color-1, 5%)
  border: 1px solid darken($color-2, 40%)
  border-top: none
  display: none
  li
    list-style: none
    label
      display: block
      width: 100%
      padding: 10px
      margin: 0px
      font-size: 14px
      cursor: pointer
    input[type="checkbox"]
      margin-right: 5px
    & + li
      border-top: 1px solid darken($color-2, 40%)
      
.custom-select
  display: none
              
            
!

JS

              
                $(document).ready(function() {
  "use strict";
  
  /*---------------
  --------- Converting Options into list (own structure) -------- */

  var myUl = [];

  $(".custom-select option").each(function() {
    var optionText = $(this).text();
    var optionValue = $(this).val();
    var thisList = $(this).parent();

    myUl.push(
      '<li><label><input type="checkbox"/>' + optionText + '</label></li>'
    );
  });

  var $p = $("<p />", {
    class: "select",
    html:
      '<span class="placeholder">Select</span><em class="fa fa-angle-down"></em>'
  });

  var $ul = $("<ul/>", {
    class: "filter_list",
    html: myUl.join("")
  });

  var expendBefore = $("<div />", {
    class: "select_box_area",
    html: [$p, $ul]
  });

  $(".custom-select").before(expendBefore);
  
  
  /*---------------
  --------- Toggle Multiselect list -------- */

  $(document).on("click", ".select", function() {
    var filterList = $(this).next(".filter_list");

    if (filterList.is(":hidden")) {
      $(filterList).fadeIn();
      $(this).find("em").addClass("angle-up");
    } else {
      $(filterList).fadeOut();
      $(this).find("em").removeClass("angle-up");
    }
  });

  /*---------------
  --------- Check and uncheck Options from the list -------- */

  $(document).on("click", '.filter_list input[type="checkbox"]', function() {
    var inputVal = $(this).parent("label").text();
    var placeholderSpan = $(".placeholder");
    var findVal = $(".select").find('span[data-title="' + inputVal + '"]');

    if ($(this).is(":checked")) {
      placeholderSpan.remove();
      $(".select").append(
        '<span data-title="' +
          inputVal +
          '" class="option">' +
          inputVal +
          "</span>"
      );
    } else {
      if ($(".select span").length >= 1) {
        findVal.remove();
      }
      if ($(".select span").length < 1) {
        $(".select").append('<span class="placeholder">Select</span>');
      }
    }
  });


});

              
            
!
999px

Console