-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(html): Add example of
<template>
(#2219)
* template * lint & typo * Add angle brackets --------- Co-authored-by: Estelle Weyl <estelle@openwebdocs.org>
- Loading branch information
1 parent
6355aad
commit 2e344a6
Showing
4 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
live-examples/html-examples/interactive-elements/css/template.css
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.info-icon { | ||
display: inline-block; | ||
background-color: #2296f3; | ||
border-radius: 50%; | ||
height: 1.5em; | ||
width: 1.5em; | ||
margin-right: 0.5em; | ||
text-align: center; | ||
color: white; | ||
} |
8 changes: 8 additions & 0 deletions
8
live-examples/html-examples/interactive-elements/js/template.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const insertBtn = document.getElementById('insert-btn'); | ||
const container = document.getElementById('container'); | ||
const template = document.getElementById('content-to-insert'); | ||
|
||
insertBtn.addEventListener('click', () => { | ||
const content = template.content.cloneNode(true);; | ||
container.appendChild(content); | ||
}); |
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
9 changes: 9 additions & 0 deletions
9
live-examples/html-examples/interactive-elements/template.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<button id="insert-btn">Send Notification</button> | ||
|
||
<p id="container"></p> | ||
|
||
<template id="content-to-insert"> | ||
<p class="info-box"> | ||
<span class="info-icon">i</span><b>You have received a new friend invitation!</b> | ||
</p> | ||
</template> |