Skip to content

Instantly share code, notes, and snippets.

@cathyxz
Created February 26, 2020 02:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cathyxz/8cee99f26856f2f7e7b4465378641272 to your computer and use it in GitHub Desktop.
Save cathyxz/8cee99f26856f2f7e7b4465378641272 to your computer and use it in GitHub Desktop.
<!doctype html>
<html >
<head>
<meta charset="utf-8">
<title>amp-sidebar - Example 1</title>
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-list" src="https://cdn.ampproject.org/v0/amp-list-0.1.js"></script>
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.2.js"></script>
<script custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js" async></script>
<link rel="canonical" href="https://preview.amp.dev/documentation/components/amp-sidebar.example.1.html">
<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>
<button on="tap:sidebar2">Open Sidebar</button>
<amp-sidebar id="sidebar2" layout="nodisplay" style="width:300px">
<amp-list
layout="fill"
src="/static/inline-examples/data/amp-list-data.json"
items="."
single-item
>
<template type="amp-mustache">
<amp-nested-menu layout="fill">
<ul>
{{#items}}
<li>
<h3 amp-nested-submenu-open>{{title}}</h3>
<div amp-nested-submenu>
<button amp-nested-submenu-close>close</button>
<amp-img
src="{{imageUrl}}"
layout="responsive"
width="400"
height="300"
></amp-img>
</div>
</li>
{{/items}}
</ul>
</nav>
</template>
</amp-list>
</amp-sidebar>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment