Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding feature detect

  • Loading branch information...
commit 93cba5138168433efd5d49b437fe2f2d9766a242 1 parent 4b7dcaf
@ebidel authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 html5-demos.appspot.com/static/css/sticky.html
View
11 html5-demos.appspot.com/static/css/sticky.html
@@ -67,6 +67,12 @@
float: right;
margin-top: 5px;
}
+.nosupport {
+ color: darkred;
+ font-weight: bold;
+ display: none;
+ text-align: center;
+}
</style>
</head>
<body>
@@ -82,6 +88,7 @@
</details>
<p style="text-align:center;font-weight: bold;">Scroll this page.</p>
+<p class="nosupport">Your browser does not support <code>position: sticky</code>!!</p>
<div data-lorem="p">
<span class="sticky"><h2>No</h2><img src="http://www.html5rocks.com/static/images/share.png" title="Just an example"></span>
@@ -89,6 +96,10 @@
<script src="lorem.js"></script>
<script>
+if (!window.getComputedStyle(document.querySelector('.sticky')).position.match('sticky')) {
+ document.querySelector('.nosupport').style.display = 'block';
+}
+
var MSGS = [
'JavaScript',
'scroll events',
Please sign in to comment.
Something went wrong with that request. Please try again.