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. 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

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

              
                .gallery
  - for (var i = 0; i < 5; i++)
    figure
      img(src='https://scriptura.github.io/Images/Demo/GrassLeaf.jpg' alt='Herbe' width='10px' height='10px')
      figcaption Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque luctus non tellus nec egestas. Donec ornare, nibh nec lacinia efficitur, lectus dolor consequat sem, eu sagittis nisi lectus eget mi.
    figure
      img(src='https://scriptura.github.io/Images/Demo/LotusMacro2000.jpg' alt='Lotus')
      figcaption Nulla porta velit vitae tincidunt semper. Suspendisse ex metus, faucibus a lectus at, commodo viverra massa. Interdum et malesuada fames ac ante ipsum primis in faucibus.
    figure
      img(src='https://scriptura.github.io/Images/Demo/OldMechanism.jpg' alt='Porte')
      figcaption Nunc lacinia libero eu rhoncus ultricies. Nulla condimentum nunc eget metus imperdiet convallis.
    figure
      img(src='https://scriptura.github.io/Images/Demo/ColorfulLeaf.jpg' alt='Feuilles')
      figcaption Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque luctus non tellus nec egestas. Donec ornare, nibh nec lacinia efficitur, lectus dolor consequat sem, eu sagittis nisi lectus eget mi.
    figure
      img(src='https://c2.staticflickr.com/2/1455/26495824182_9a79184e16_o.jpg' alt='Tunel')
      figcaption Aliquam eget lorem interdum, tempus nulla eget, condimentum dolor. Etiam tellus felis, commodo vitae ligula at, finibus tempor sapien.
    figure
      img(src='https://scriptura.github.io/Images/Demo/PacificCity.jpg' alt='Pacifique')
      figcaption Fusce sagittis nisl vitae volutpat fringilla. Donec elementum nisi eget augue egestas pharetra. Etiam sit amet pharetra felis.
              
            
!

CSS

              
                .js .gallery > :first-child figure
  margin 0
  background-color #222

.js .gallery > :first-child img
  display block
  max-height calc(90vh - 9.5rem)
  max-width 100%
  margin auto

.js .gallery > :first-child figcaption
  padding .5rem
  font-family Arial
  color #777

.js .gallery > :last-child div
  overflow auto
  display flex
  //flex-wrap wrap
  justify-content space-between
  align-items center
  margin-top .5rem
  padding .3rem
  background-color #222

.js .gallery > :last-child a
  outline none

.js .gallery > :last-child figure
  margin 0

.js .gallery > :last-child img
  max-width 5rem
  max-height 5rem
  margin .3rem

.js .gallery > :last-child figcaption
  display none

.js .gallery > :last-child a
  transition .3s transform
  transform scale(1)

.js .gallery > :last-child a:focus
.js .gallery > :last-child a:hover
.js .gallery > :last-child a:active
  transform scale(1.05)

body
  margin 0 2rem
  background-color #333

              
            
!

JS

              
                jQuery.fn.gallery = function() {
	var gallery = $( this );
	gallery.find( '> *' ).wrapAll( '<div><div></div></div>' );
	gallery.prepend( '<div><visio></visio></div>' );
	gallery.find( 'img' )
		.removeAttr( 'width' )
		.removeAttr( 'height' );
	 var items = gallery.find( 'figure' );
	var imgInit = gallery.find( ':last-child figure:first-child' );
	var n = 0;
	$( gallery.find( ':last-child figure' ) ).each( function() {
		n = n + 1;
		$( this ).wrap( '<a href="#gallery-' + n + '"/>' );
	} );
	var imgClone = imgInit.clone();
	$( 'visio' ).replaceWith( imgClone );
	gallery.on( 'focus click', '> :last-child a', function( e ) {
		var imgVisio = $( this ).find( 'figure' ).clone();
		gallery.find( ' > :first-child figure' )
			.replaceWith( imgVisio );
		e.stopPropagation();
		//e.preventDefault();
	} );
};

jQuery( '.gallery' ).gallery();

$( 'html' ).addClass( 'js' ); // For demo
              
            
!
999px

Console