cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              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
    
    
  
            
          
!
            
              /*---------------
  ---------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
            
          
!
            
              $(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
Loading ..................

Console