Last active
September 22, 2017 16:15
-
-
Save rojasmi1/ddd04fa0de175eea8de882c27f7c6b5a to your computer and use it in GitHub Desktop.
Sample of search form with AMP
This file contains 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 ⚡> | |
<head> | |
<meta charset="utf-8"> | |
<script async src="https://cdn.ampproject.org/v0.js"></script> | |
<script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script> | |
<script async custom-element="amp-bind" src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script> | |
<link rel="canonical" href="https://ampbyexample.com/components/amp-form/"> | |
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> | |
<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-state id="searchFormState"> | |
<script type="application/json"> | |
{ | |
"currentState": "outOfFocus", | |
"focused": { "class": "search__button-search-focused icon-search", "keyword": " " }, | |
"outOfFocus": { "class": "search__button-search icon-search", "keyword": "" } | |
} | |
</script> | |
</amp-state> | |
<form method="post" | |
class="p2" | |
action-xhr="/components/amp-form/submit-form-input-text-xhr" | |
target="_top"> | |
<div class="ampstart-input inline-block relative m0 p0 mb3"> | |
<input type="text" | |
class="block border-none p0 m0" | |
name="name" | |
placeholder="Name..." | |
role="button" | |
required> | |
</div> | |
<input type="submit" value="Subscribe" class="ampstart-btn caps"> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment