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

              
                <div class="container">
  <div class="row">
    <h1>Bootstrap Lightbox - no plugin</h1>
    <div class="row">
      <div class="col-xs-6 col-sm-4">
        <a class="lightbox" title="Image 1" href="#">
          <img class="thumbnail" src="//lorempixel.com/240/140/nature/1">
        </a>
      </div>
      <div class="col-xs-6 col-sm-4">
        <a class="lightbox" title="Image 2" href="#">
        <img class="thumbnail" src="//lorempixel.com/240/140/nature/2">
        </a>
      </div>
      <div class="col-xs-6 col-sm-4">
        <a class="lightbox" title="Image 3" href="#">
          <img class="thumbnail" src="//lorempixel.com/240/140/nature/3">
        </a>
      </div>
      <div class="col-xs-6 col-sm-4">
        <a class="lightbox" title="Image 4" href="#">
          <img class="thumbnail" src="//lorempixel.com/240/140/nature/4">
        </a>
      </div>
      <div class="col-xs-6 col-sm-4">
        <a class="lightbox" title="Image 5" href="#">
          <img class="thumbnail" src="//lorempixel.com/240/140/nature/5">
        </a>
      </div>
      <div class="col-xs-6 col-sm-4">
        <a class="lightbox" title="Image 6" href="#">
          <img class="thumbnail" src="//lorempixel.com/240/140/nature/6">
        </a>
      </div>
      <div class="col-xs-6 col-sm-4">
        <a class="lightbox" title="Image 8" href="#">
          <img class="thumbnail" src="//lorempixel.com/240/140/nature/7">
        </a>
      </div>
      <div class="col-xs-6 col-sm-4">
        <a class="lightbox" title="Image 9" href="#">
          <img class="thumbnail" src="//lorempixel.com/240/140/nature/8">
        </a>
      </div>
      <div class="col-xs-6 col-sm-4">
        <a class="lightbox" title="Image 10" href="#">
          <img class="thumbnail" src="//lorempixel.com/240/140/nature/9">
        </a>
      </div>
    </div>
  </div>
</div>
<div tabindex="-1" class="modal fade" id="lightbox" role="dialog">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button class="close" type="button" data-dismiss="modal">×</button>
        <h3 class="modal-title">Heading</h3>
      </div>
      <div class="modal-body text-center">
      </div>
      <div class="modal-footer">
        <button class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>


              
            
!

CSS

              
                .lightbox .thumbnail{margin: 1em auto;}
              
            
!

JS

              
                $('.lightbox').click(function() {
		var title = $(this).attr('title');
		var src = $(this).children('img').attr("src").replace('/240/140/', '/480/280/');
		// Change the line above to modify the src according to your naming convention for larger images. 
		// You could even change it to source a data attrib ;)

		var alt = $(this).children('img').attr("alt") || "";
		var $img = $('<img class="center-block img-responsive" alt="' + alt + '" src="' + src + '">');
		$('.modal-title').html(title);
		$('.modal-body').html('<p>Loading...</p>');
		$('#lightbox').modal({
				show: true
		});
		$img.load(function() {
				$('.modal-body').html($img);
		})
});
              
            
!
999px

Console