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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="container">
  <br/>
  <h1>Select2 - diablo3 style</h1><br/>
  <div class="row">
    <div class="col-md-6">
      <h3>Single select // Character selection :</h3>
      <select class="d3-select" id="character-selection" data-placeholder="Choose a character..." style="width: 100%">
        <option></option>
          <option value="barbarian">Barbarian</option>
          <option value="crusader">Crusader</option>
        <option value="demon-hunter">Demon Hunter</option>                  <option value="Monk">Monk</option>
       <option value="necromancer">Necromancer</option>
       <option value="witch-doctor">Witch Doctor</option>
        <option value="wizard">Wizard</option>
      </select>
    </div>
  </div>
  <div class="row">
    <div class="col-md-6">
      <br/><br/>
      <h3>Multiple select // Conquest selection :</h3>
      <select class="d3-select" id="conquest-selection" data-placeholder="Choose a conquest..." multiple style="width: 100%">
         <option value="Race to the top">Race to the top</option>
         <option value="Living Dangerously">Living Dangerously</option>
         <option value="It's A Marathon...">It's A Marathon...</option>       
         <option value="Better Lucky Than Good">Better Lucky Than Good</option>
        <option value="Divinity">Divinity</option>
       <option value="Lionhearted">Lionhearted</option>
        <option value="Sprinter">Sprinter</option>
        <option value="Speed Racer">Speed Racer</option>
        <option value="Death Gets Got">Death Gets Got</option>
       <option value="Sprinter">Top Spot</option>
       <option value="Now You've Done It">Now You've Done It</option>
       <option value="Now You've Really Done It">Now You've Really Done It</option>
        <option value="The Thrill">The Thrill</option>
        <option value="Super Human">Super Human</option>
        <option value="On a good day">On a good day</option>
        <option value="I can't stop">I can't stop</option>
         <option value="Avarice">Avarice</option>
       <option value="Avaritia">Avaritia</option>                             
      </select>
    </div>
  </div>
  <br/>
  <div class="row">
    <div class="col-md-6">
      <h3>Single select // nice scrollbar :</h3>
      <select class="devkit" id="jus" data-placeholder="Choose a character..." style="width: 100%">
        <option></option>
          <option value="barbarian">Barbarian</option>
          <option value="crusader">Crusader</option>
        <option value="demon-hunter">Demon Hunter</option>                  <option value="Monk">Monk</option>
       <option value="necromancer">Necromancer</option>
       <option value="witch-doctor">Witch Doctor</option>
        <option value="wizard">Wizard</option>
      </select>
    </div>
  </div>
  
  
</div>
            
          
!
            
              .select2-container .select2-selection--single{
    height:44px;
}

:focus{
  outline:none;
}

.select2-container--default .select2-selection--single, .select2-container--default .select2-selection--multiple, 
.select2-container--default.select2-container--focus .select2-selection--multiple{
    border:none;
    border-radius: 0;
    border-style: solid;
    border-width: 7px 7px 7px 7px;
    -moz-border-image: url(https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/scrolldown.png) 7 7 7 7 fill stretch repeat;
    -webkit-border-image: url(https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/scrolldown.png) 7 7 7 7 fill stretch repeat;
    -o-border-image: url(https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/scrolldown.png) 7 7 7 7 fill stretch repeat;
    border-image: url(https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/scrolldown.png) 7 7 7 7 fill stretch repeat;
    font-size: 18px;
    text-shadow: 1px 1px #444444;
    background:none;
    position:relative;
}

.select2-container .select2-selection.select2-selection--multiple .select2-search.select2-search--inline .select2-search__field:not([placeholder='']) {
  width: 100% !important;
  margin-right: 100000px;
}

.select2-dropdown{
    border:none;
    border-radius: 0;
        border-style: solid;
    border-width: 7px 7px 7px 7px;
    -moz-border-image: url(https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/scrolldown.png) 7 7 7 7 fill stretch repeat;
    -webkit-border-image: url(https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/scrolldown.png) 7 7 7 7 fill stretch repeat;
    -o-border-image: url(https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/scrolldown.png) 7 7 7 7 fill stretch repeat;
    border-image: url(https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/scrolldown.png) 7 7 7 7 fill stretch repeat;
    background:none;
}

.select2-container--open .select2-dropdown--below{
    border-top:7px solid;
    top:-4px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered, 
.select2-container--default .select2-selection--multiple .select2-selection__rendered{
    line-height:30px;
    color:white;
}

.select2-container--default .select2-selection--single .select2-selection__arrow, 
.select2-container--default .select2-selection--multiple .select2-selection__arrow{

    top: 0;
    bottom: 0;
    right: 0;
    margin: auto;
    margin-right: -1px;
    width: 32px;
    height: 32px;
    background: url(https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/ScrolldownButton.png);
    background-position: left top;
}


.select2-container--default:not(.select2-container--disabled) .select2-selection--single:hover .select2-selection__arrow{
    background-position: left center;
}

.select2-container--default:not(.select2-container--disabled) .select2-selection--single:active .select2-selection__arrow{
    background-position: left bottom;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow{
    background-position: center top;
}

.select2-container--default.select2-container--open .select2-selection--single:hover .select2-selection__arrow{
    background-position: center center;
}

.select2-container--default.select2-container--open .select2-selection--single:active .select2-selection__arrow{
    background-position: center bottom;
}


.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__arrow{
    background-position: right center;
}

.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__rendered{
    color:grey;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b, 
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border: none;
  }

.select2-container--default.select2-container--disabled .select2-selection--single{
    background:none;
}

  .select2-container--default .select2-results__option[aria-selected=true]{
    background-color:#810102;
    color:white;
  }

    .select2-container--default .select2-results__option--highlighted[aria-selected=false],  
     .select2-container--default .select2-results__option[aria-selected=true]:hover{
    background-color:#da7e01;
    color:white;
  }

  .select2-results__options{
    color:#b3a684;
  }

  .img-flag {
    height: 26px;
    width: 26px;
    margin-top: -4px;
}

/*scroll*/

.mCSB_inside>.mCSB_container{
        margin-right:38px;
    }

   .mCSB_inside>.mCSB_container{
    margin-right:34px;
   }

   .mCSB_scrollTools{
        width:33px;
        min-height:10px;
        opacity:1;
    }

     .mCSB_scrollTools .mCSB_buttonUp{
        background-image: url(https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/ScrollArrowBottom.png);
        width:33px;
        height:33px;
        left:0;
        right:0;
        margin:auto;
        background-position:right top !important;
        opacity:1;
    }


     .mCSB_scrollTools .mCSB_buttonDown{
        background-image: url(https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/ScrollArrowBottom.png);
        width:33px;
        height:33px;
        left:0;
        right:0;
        margin:auto;
        background-position:left top !important;
        opacity:1;
    }

   .mCSB_scrollTools .mCSB_buttonUp:hover{
        background-position:right -33px !important;
    }

    .mCSB_scrollTools .mCSB_buttonDown:hover{
        background-position:left -33px !important;
    }

    .mCSB_scrollTools .mCSB_buttonUp:active{
        background-position:right -66px !important;
    }

   .mCSB_scrollTools .mCSB_buttonDown:active{
        background-position:left -66px !important;
    }

     .mCSB_scrollTools a+.mCSB_draggerContainer{
        margin-top:35px;
        margin-bottom:33px;
    }

     .mCS-light-2.mCSB_scrollTools .mCSB_draggerRail{
        width:100%;
        background:url("https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/scrollbar-vertical.png");
    }

.mCS-light-2.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar {
    width: 100%;
    background: url(https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/ScrollButton.png);
    background-position: left top !important;
}
     .mCSB_scrollTools .mCSB_dragger{
        width:25px;
        height: 35px;
        left:0;
        right:0;
        margin:auto;
    }

.scrollbar-inner > .scroll-element,
.scrollbar-inner > .scroll-element div
{
    border: none;
    margin: 0;
    padding: 0;
    position: absolute;
    z-index: 10;
}
 
.scrollbar-inner > .scroll-element div {
    display: block;
    height: 100%;
    left: 0;
    top: 0;
    width: 100%;
}
 
.scrollbar-inner > .scroll-element.scroll-x {
    bottom: 2px;
    height: 8px;
    left: 0;
    width: 100%;
}
 
.scrollbar-inner > .scroll-element.scroll-y {
    height: 100%;
    right: 2px;
    top: 0;
    width: 8px;
}
 
.scrollbar-inner > .scroll-element .scroll-element_outer {
    overflow: hidden;
}
 
.scrollbar-inner > .scroll-element .scroll-element_outer,
.scrollbar-inner > .scroll-element .scroll-element_track,
.scrollbar-inner > .scroll-element .scroll-bar {
    -webkit-border-radius: 8px;
    -moz-border-radius: 8px;
    border-radius: 8px;
}
 
.scrollbar-inner > .scroll-element .scroll-element_track,
.scrollbar-inner > .scroll-element .scroll-bar {
    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";
    filter: alpha(opacity=40);
    opacity: 0.4;
}
 
.scrollbar-inner > .scroll-element .scroll-element_track { background-color: #e0e0e0; }
.scrollbar-inner > .scroll-element .scroll-bar { background-color: #c2c2c2; }
.scrollbar-inner > .scroll-element:hover .scroll-bar { background-color: #919191; }
.scrollbar-inner > .scroll-element.scroll-draggable .scroll-bar { background-color: #919191; }
 
 
/* update scrollbar offset if both scrolls are visible */
 
.scrollbar-inner > .scroll-element.scroll-x.scroll-scrolly_visible .scroll-element_track { left: -12px; }
.scrollbar-inner > .scroll-element.scroll-y.scroll-scrollx_visible .scroll-element_track { top: -12px; }
 
 
.scrollbar-inner > .scroll-element.scroll-x.scroll-scrolly_visible .scroll-element_size { left: -12px; }
.scrollbar-inner > .scroll-element.scroll-y.scroll-scrollx_visible .scroll-element_size { top: -12px; }

.scroll-wrapper {
    overflow: hidden !important;
    padding: 0 !important;
    position: relative;
}
 
.scroll-wrapper > .scroll-content {
    border: none !important;
    box-sizing: content-box !important;
    height: auto;
    left: 0;
    margin: 0;
    max-height: none;
    max-width: none !important;
    overflow: scroll !important;
    padding: 0;
    position: relative !important;
    top: 0;
    width: auto !important;
}
 
.scroll-wrapper > .scroll-content::-webkit-scrollbar {
    height: 0;
    width: 0;
}
 
.scroll-element {
    display: none;
}
.scroll-element, .scroll-element div {
    box-sizing: content-box;
}
 
.scroll-element.scroll-x.scroll-scrollx_visible,
.scroll-element.scroll-y.scroll-scrolly_visible {
    display: block;
}
 
.scroll-element .scroll-bar,
.scroll-element .scroll-arrow {
    cursor: default;
}
 
.scroll-textarea {
    border: 1px solid #cccccc;
    border-top-color: #999999;
}
.scroll-textarea > .scroll-content {
    overflow: hidden !important;
}
.scroll-textarea > .scroll-content > textarea {
    border: none !important;
    box-sizing: border-box;
    height: 100% !important;
    margin: 0;
    max-height: none !important;
    max-width: none !important;
    overflow: scroll !important;
    outline: none;
    padding: 2px;
    position: relative !important;
    top: 0;
    width: 100% !important;
}
.scroll-textarea > .scroll-content > textarea::-webkit-scrollbar {
    height: 0;
    width: 0;
}
            
          
!
            
              function charactersFaces (state) {

    if (!state.id) {  return state.text; }
    var image_src = '';
  var select_value = state.element.value.toLowerCase();
    var $state = state.text;
  
 if(select_value === "barbarian")       {
        image_src = 'https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/barbarianmale.png';
      }
      else if(select_value === "crusader"){
            image_src = 'https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/crusadermale.png'; 
         }
      else if(select_value === "demon-hunter"){
            image_src = 'https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/demon-huntermale.png'; 
         }
      else if(select_value === "monk"){
            image_src = 'https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/monkmale.png'; 
         }
      else if(select_value === "necromancer"){
            image_src = 'https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/necromancermale.png'; 
         }
      else if(select_value === "witch-doctor"){
            image_src = 'https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/witch-doctormale.png'; 
         }
      else
        {
           image_src = 'https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/wizardmale.png';
        }
   if (state.text !== "All"){
     
        $state = $(
            '<span><img src="' + image_src + '" class="img-flag" /> ' + state.text + '</span>'
        );
        
    }
    return $state; 
};


$("#character-selection").select2({
    templateResult: charactersFaces,
    templateSelection : charactersFaces,
    minimumResultsForSearch: Infinity
});

$("#conquest-selection").select2({
    minimumResultsForSearch: Infinity
});

$('.d3-select').on('select2:opening', function () {
       jQuery('.select2-results__options').scrollbar(
       {
        "showArrows": true,
        "scrollx": "advanced",
        "scrolly": "advanced"
    });
    /*setTimeout(function() {


        $('.select2-dropdown .select2-results__options').mCustomScrollbar({
            scrollButtons:{
                    enable:true,
                    scrollAmount : "auto",
                    scrollType: "stepless" 
                },
                keyboard:{ 
                    enable: true,
                    scrollAmount : "auto",
                    scrollType: "stepless" 
                },
                autoDraggerLength: false,
                autoHideScrollbar : false,
                autoExpandScrollbar : false,
                snapAmount : 5,
                alwaysShowScrollbar : 0 ,
                mouseWheel:{ 
                    disableOver: ["select","option","keygen","datalist","textarea"],
                    deltaFactor : "100"
                },
                theme : "light-2"
        });

    }, 0);*/
});

$('.selectpicker, .type_of_char, .conquests-select, .season-objectives').on('select2:closing', function () {
  /*  $('.select2-dropdown .select2-results__options').mCustomScrollbar('destroy');*/
});

var select2 = $("#jus").select2({
    templateResult: charactersFaces,
    templateSelection : charactersFaces,
    minimumResultsForSearch: Infinity
});

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console