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.

            
              <h2>Bootstrap 3 Custom Modals Demo</h2>

<!-- Link triggered modal -->
<p><a href="#" 
      data-toggle="modal" 
      data-target="#customPositionModal">Click to open a Modal with custom positioning</a></p>
   
<!-- Button triggered modal -->
<p><button type="button" 
        class="btn btn-primary btn" 
        data-toggle="modal" 
        data-target="#customPositionModal">
  Click to open a Modal with custom positioning
  </button></p>

<hr>
<!-- Link triggered modal -->
<p><a href="#" 
      data-toggle="modal" 
      data-target="#customSizeModal">Click to open a custom-sized Modal</a></p>
   
<!-- Button triggered modal -->
<p><button type="button" 
        class="btn btn-success" 
        data-toggle="modal" 
        data-target="#customSizeModal">
  Click to open a custom-sized Modal
  </button></p>

<hr>
<!-- Link triggered modal -->
<p><a href="#" 
      data-toggle="modal" 
      data-target="#customHeaderModal"
      class="text-muted">Default</a>
   &nbsp;
   <a href="#" 
      data-toggle="modal" 
      data-target="#customHeaderModal"
      class="text-primary">Primary</a>
   &nbsp;
   <a href="#" 
      data-toggle="modal" 
      data-target="#customHeaderModal"
      class="text-success">Success</a>
   &nbsp;
   <a href="#" 
      data-toggle="modal" 
      data-target="#customHeaderModal"
      class="text-info">Info</a>
   &nbsp;
   <a href="#" 
      data-toggle="modal" 
      data-target="#customHeaderModal"
      class="text-warning">Warning</a>
   &nbsp;
   <a href="#" 
      data-toggle="modal" 
      data-target="#customHeaderModal"
      class="text-danger">Danger</a>
</p>

<!-- Button triggered modal -->
<p><button type="button" 
        class="btn btn-muted" 
        data-toggle="modal" 
        data-target="#customHeaderModal">
  Default
  </button>
  &nbsp;
  <button type="button" 
        class="btn btn-primary" 
        data-toggle="modal" 
        data-target="#customHeaderModal">
  Primary
  </button>
  &nbsp;
  <button type="button" 
        class="btn btn-success" 
        data-toggle="modal" 
        data-target="#customHeaderModal">
  Success
  </button>
  &nbsp;
  <button type="button" 
        class="btn btn-info" 
        data-toggle="modal" 
        data-target="#customHeaderModal">
  Info
  </button>
  &nbsp;
  <button type="button" 
        class="btn btn-warning" 
        data-toggle="modal" 
        data-target="#customHeaderModal">
  Warning
  </button>
  &nbsp;
  <button type="button" 
        class="btn btn-danger" 
        data-toggle="modal" 
        data-target="#customHeaderModal">
  Danger
  </button>
</p>

<!-- Modal DIVS -->
<div class="modal fade" id="customPositionModal" tabindex="-1" role="dialog" aria-labelledby="customPositionModal" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h4 class="modal-title">Custom Positioned Modal</h4>
            </div>
            <div class="modal-body">
                <p>Hi, I'm a Modal with custom positioning of:</p>
                <pre>
#customPositionModal {
  top:5%;
  right:50%;
  outline: none;
}
                </pre>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
    </div>
  </div>
</div>

<div class="modal fade" id="customSizeModal" tabindex="-1" role="dialog" aria-labelledby="customSizeModal" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h4 class="modal-title">Custom Size Modal</h4>
            </div>
            <div class="modal-body">
              <p>Hi, I'm a custom-sized Modal with a width of <span id="width"></span>.</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
    </div>
  </div>
</div>

<div class="modal fade" id="customHeaderModal" tabindex="-1"
    role="dialog" aria-labelledby="customHeaderModal" aria-hidden="true">
  <div class="modal-dialog">
      <div class="modal-content panel-default">
          <div class="modal-header panel-heading">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <h4 class="modal-title"></h4>
          </div>
          <div class="modal-body">
              <h3>Modal Body</h3>
          </div>
          <div class="modal-footer">
              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
    </div>
  </div>
</div>


<br/>
<br/>
<hr size="2" />
<p>If you find this demo useful, please consider <a href="https://paypal.me/RobertGravelle/1" target="_blank">donating $1 dollar</a> (secure PayPal link) for a coffee or purchasing one of my songs from <a href="http://ax.itunes.apple.com/WebObjects/MZSearch.woa/wa/search?term=rob%20gravelle" target="_blank">iTunes.com</a> or <a href="http://www.amazon.com/s/ref=ntt_srch_drd_B001ES9TTK?ie=UTF8&field-keywords=Rob%20Gravelle&index=digital-music&search-type=ss" target="_blank">Amazon.com</a> for only 0.99 cents each. </p>
<p>Rob uses and recommends <a href="http://www.mochahost.com/2425.html" target="_blank">MochaHost</a>, which provides Web Hosting for as low as $1.95 per month, as well as unlimited emails and disk space!</p>

            
          
!
            
              body { text-align: center; }

#customPositionModal {
  top:5%;
  right:50%;
  outline: none;
}

#customSizeModal .modal-dialog  { 
  width: 75%; 
}

pre {
  text-align: left;
}

@media screen and (min-width: 768px) {
	#customSizeModal .modal-dialog { 
    width: 50%; 
  }
}

a[data-target="#customHeaderModal"] {
  text-decoration: underline; 
} 

.panel-heading {
    border-top-left-radius: inherit; 
    border-top-right-radius: inherit;
}
            
          
!
            
              jQuery.fn.extend({
  swapClass: function(oldClassRegex, newClass, animationSpeed) {
      animationSpeed = animationSpeed || 500;
      return this.removeClass(function(index, className) {
          return (className.match(oldClassRegex) || [])[0];
      }).addClass( newClass, animationSpeed );
  }
});

$('#customSizeModal').on('show.bs.modal', function() {
    var rules = document.styleSheets[1].rules || document.styleSheets[1].cssRules,
        mql   = window.matchMedia("screen and (min-width: 768px)"),
        width;
  
    for (var i=0; i<rules.length && !width; i++) {
      var rule = rules[i];
      if (  mql.matches === true
            &&  rule.parentRule 
            && rule.parentRule.type === CSSRule.MEDIA_RULE
          || mql.matches === false 
            && rule.type === CSSRule.STYLE_RULE
            && rule.selectorText == '#customSizeModal .modal-dialog') {
        width = rule.style.getPropertyValue("width");
      }
      else if (  mql.matches === true 
              && rule.type === CSSRule.MEDIA_RULE) {
        for (var j=0; j<rule.cssRules.length && !width; j++) {
          var mediaRule = rule.cssRules[j];
          if (mediaRule.selectorText == '#customSizeModal .modal-dialog') {
            width = mediaRule.style.getPropertyValue("width");
          }
        }
      }
    }
    $(this).find("#width").text(width);
});

$('#customHeaderModal').on('show.bs.modal', function(event) {
  var label = $(event.relatedTarget).text().trim();
  $(this).find('.modal-content')
         .swapClass(/\bpanel-\w+\b/, 
                    'panel-' + label.toLowerCase())
         .find('.modal-title').text(label + ' Header');
});
            
          
!
999px
Loading ..................

Console