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.

            
              <h1>mgGlitch.js : a small jQuery helper for glitch</h1>

<div class="container">
   <!-- this elem will be glitch -->
   <div class="glitch-img" style="background-image: url('http://hmongouachon.com/assets/img/demos/mosh1.jpg')"></div>
</div>

<p>Find this project on <a href="https://github.com/hmongouachon/mgGlitch" title="Github">Github</a></p>

            
          
!
            
              *, *:after, *:before {
  -moz-box-sizing:border-box; 
   box-sizing:border-box;
}

body, html {
  position: relative; 
  height: 100%; 
  width: 100%; 
  overflow: hidden;
}

body { 
  background-color: #fff; 
  margin: 0; 
}

h1 {
  position: absolute; 
  top:0; 
  left :0; 
  z-index: 10;
  width: 100%;
  text-align: center; 
  font-family: 'Roboto', Arial, Helvetica, sans-serif;
  margin-top: 30px; 
  font-size: 16px; 
  color: #f54955; 
}

p { 
  position: absolute; 
  bottom:0; 
  left :0; 
  z-index: 10; 
  width: 100%; 
  text-align: center; 
  font-family: 'Roboto', Arial, Helvetica, sans-serif;
  color: #999999;  
  margin-bottom: 30px; 
  font-size: 14px;
}

p a {
  color: #f54955; 
  text-decoration: none; 
  outline: none;
}
        
.container {
  position: relative; 
  margin: 80px; 
  background-color: #fff; 
  width: calc(100% - 160px); 
  height: calc(100% - 160px); 
  overflow: hidden; 
}

/* glitch elem must have absolute position */
 .glitch-img {
   position: absolute; 
   width : 100%; 
   height : 100%; 
   top: 0 ; 
   left : 0; 
   background-position:center;  
   -moz-background-size:cover;
   -o-background-size:cover;
   -webkit-background-size:cover;
   background-size:cover;
   opacity : 1
 } 
            
          
!
            
              // https://github.com/hmongouachon/mgGlitch

$( function() {
		$( ".glitch-img" ).mgGlitch({
          // set 'true' to stop the plugin
				  destroy : false, 
          // set 'false' to stop glitching
          glitch: true, 
          // set 'false' to stop scaling
          scale: true, 
          // set 'false' to stop glitch blending
          blend : true, 
          // select blend mode type
          blendModeType : 'hue',
          // set min time for glitch 1 elem
          glitch1TimeMin : 200, 
          // set max time for glitch 1 elem
          glitch1TimeMax : 400,
          // set min time for glitch 2 elem
          glitch2TimeMin : 10, 
          // set max time for glitch 2 elem
          glitch2TimeMax : 100, 
		});
});
            
          
!
999px
Loading ..................

Console