Created
August 21, 2019 22:48
-
-
Save alankent/4b00d383d6ebe06591deb5cd709a45e5 to your computer and use it in GitHub Desktop.
Testing AMP amp-script and float (when served locally, bug causes script not to load external file)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html amp lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<script async src="https://cdn.ampproject.org/v0.js"></script> | |
<title>AMP Script Example</title> | |
<link rel="canonical" href="https://www.example.com/url/to/myself/if/amp-first"> | |
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> | |
<script async custom-element="amp-script" src="https://cdn.ampproject.org/v0/amp-script-0.1.js"></script> | |
<style amp-custom> | |
button { | |
float: left; | |
} | |
</style> | |
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> | |
</head> | |
<body> | |
<amp-script layout="container" src="as.js"> | |
<button>Hello amp-script!</button> | |
</amp-script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const btn = document.querySelector('button'); | |
btn.addEventListener('click', () => { | |
var para = document.createElement("p"); | |
var text = document.createTextNode('Hello World!'); | |
para.appendChild(text); | |
document.body.appendChild(para); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment