Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <h3>Pass pointer events through for IE11 &amp; below that don't support CSS pointer-events</h3>

<div id="container-outer">
	<div id="container">
		<div class="box" style="top: 25px; left: 25px;"></div>
		<div class="box" style="top: 50px; left: 125px;"></div>
		<div class="box" style="position:absolute; top: 100px; left: 25px;"></div>
		<div class="box" style="top: 125px; left: 180px;"></div>
		<div class="box" style="top: 225px; left: 25px;"></div>
		<div class="box" style="top: 185px; left: 125px;"></div>
	</div>
	<div id="shield"></div>
</div>

<div id="controls">
	<input id="passpointer" type="checkbox" checked>
    <em>Pass pointer events through the red bar</em><br><br>
    Test in IE10 and below<br>
    Try clicking a small box when the red bar animates down<br>
    When the checkbox is checked you can click through the red bar to a small box<br>
    If the checkbox is unchecked you can NOT click through the red bar
    <br><br>
  <b>Why this is needed for IE10 and below:</b>
    <ol>
      <li> CSS Pointer-events do not work on links in IE11 unless the CSS display property is set to block or inline-block.</li>
      <li>Moving the scrollbar on an object with pointer-events: none; works in Firefox, but doesn't work in either Chrome or IE.</li>
      <li>IE 9 and 10 return true on 'pointerEvents' in document.documentElement.style due to support on SVG elements, but they don't support it on HTML elements.</li>
      <li>Does not work in IE11 on select elements if only a parent has the property set (though it does work if the select element has it set explicitly)</li>
    </ol>
    </div>


              
            
!

CSS

              
                html, body{
  height:100%;
}

body { background-color: #000; }

h3 {
  color:#FFF;
  font-weight:bold;
  font-family:"Open Sans", Arial;
}

#container-outer {
	position:relative;
	width:245px;
	height:300px;
	overflow:hidden;
}

#container {
	position:relative;
}

.box {
  position:absolute;
	width: 50px;
	height: 50px;
	border: 1px solid white;
  background:#FFF;
  background:rgba(255,255,255,0.7);
  cursor:pointer;
}

.highlight { background-color: yellow; }

#controls {
	position: absolute;
	top: 370px;
	color: white;
}

#shield {
	position: absolute; 
	width: 200px; 
	top: 0px; 
	background-color: #F00; 
	opacity: 0.5;
	height:275px;
	width:250px;
	z-index:10;
}
              
            
!

JS

              
                jQuery(function() {

  // actual original event
  jQuery(document).on("click", ".box", function() {
    jQuery(this).toggleClass("highlight");
  });

  // pointer-events workaround
  // check if clicked point (taken from event) 
  // is inside element
  function passThrough(e) {

    $("#container-outer .box").each(function(i, el) {
      
      var $this = $(el),
          mouseX = e.pageX,
          mouseY = e.pageY,
          offset = $this.offset(),
          width = $this.width(),
          height = $this.height();
      
      if (mouseX > offset.left && mouseX < offset.left + width && mouseY > offset.top && mouseY < offset.top + height) {
        // force click event
        $this.click();
      }
    });
  }
  // pointer-events workaround
  

  $("#shield").click(passThrough);

     var dthen = new Date();

     setInterval(function() {
    
        var dNow = new Date();
        TweenMax.set($('#shield'), {
          'height': ((dNow.getSeconds() + (dNow.getMilliseconds() / 1000)) * 50) % 300 + 'px'
    });
    
  }, 10);

  // checkbox for enable/disable passThrough
  var doPassThrough = true;
  jQuery(document).on("click", '#passpointer', function(){
    
    doPassThrough = !doPassThrough;
    
    $shield = jQuery("#shield");
    
    if (doPassThrough) {
      $shield.click(passThrough);
    } else {
      $shield.unbind('click', passThrough);
    }
  });

});
              
            
!
999px

Console