-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(DIST-682): Send post message only if the form is present on page
- Loading branch information
Matej Lednicky
committed
Mar 23, 2021
1 parent
5277fde
commit 3d3c5a5
Showing
4 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
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,39 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>Widget example</title> | ||
<meta charset="utf-8" /> | ||
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" /> | ||
<link rel="stylesheet" href="demo.css" /> | ||
</head> | ||
<body> | ||
<p>A typeform widget will load below</p> | ||
<ul> | ||
<li><a href="#" onClick="openTab(0)">form one</a></li> | ||
<li><a href="#" onClick="openTab(1)">form two</a></li> | ||
<li><a href="#" onClick="openTab(2)">form three</a></li> | ||
<li><a href="#" onClick="openTab(3)">form four</a></li> | ||
</ul> | ||
<div id="content"></div> | ||
|
||
<script type="text/javascript" src="embed.js"></script> | ||
<script type="text/javascript" src="demo.js"></script> | ||
|
||
<script> | ||
const forms = [ | ||
'//betatests.typeform.com/to/Z9k3bK', | ||
'//betatests.typeform.com/to/qPu9dB', | ||
'//lednicky.typeform.com/to/Cqrg7cgL', | ||
'//lednicky.typeform.com/to/jAJ5qj', | ||
] | ||
function openTab(index) { | ||
const elm = document.querySelector('#content') | ||
elm.innerHTML = '' | ||
|
||
const widget = document.createElement('div') | ||
elm.append(widget) | ||
window.typeformEmbed.makeWidget(widget, forms[index]) | ||
} | ||
</script> | ||
</body> | ||
</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
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
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