PageRenderTime 43ms CodeModel.GetById 20ms app.highlight 7ms RepoModel.GetById 13ms app.codeStats 0ms

/demo/sample-iframe.html

https://github.com/briscoeej/fancytree
HTML | 132 lines | 118 code | 8 blank | 6 comment | 0 complexity | 51baa2f3460bf51385c7917e86bfa1bf MD5 | raw file
  1<!DOCTYPE html>
  2<html>
  3<head>
  4	<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  5	<title>Fancytree - Example</title>
  6
  7	<script src="../lib/jquery.js" type="text/javascript"></script>
  8	<script src="../lib/jquery-ui.custom.js" type="text/javascript"></script>
  9
 10	<link href="../src/skin-win7/ui.fancytree.css" rel="stylesheet" type="text/css">
 11	<script src="../src/jquery.fancytree.js" type="text/javascript"></script>
 12
 13	<!-- Start_Exclude: This block is not part of the sample code -->
 14	<link href="../lib/prettify.css" rel="stylesheet">
 15	<script src="../lib/prettify.js" type="text/javascript"></script>
 16	<link href="sample.css" rel="stylesheet" type="text/css">
 17	<script src="sample.js" type="text/javascript"></script>
 18	<!-- End_Exclude -->
 19
 20   <style type="text/css">
 21		#tree {
 22			vertical-align: top;
 23			width: 250px;
 24		}
 25		iframe {
 26			border: 1px dotted gray;
 27		}
 28	</style>
 29	<!-- Add code to initialize the tree when the document is loaded: -->
 30	<script type="text/javascript">
 31	$(function(){
 32		// Attach the dynatree widget to an existing <div id="tree"> element
 33		// and pass the tree options as an argument to the dynatree() function:
 34		$("#tree").fancytree({
 35//          autoCollapse: true,
 36			minExpandLevel: 1,
 37			postinit: function(isReloading, isError) {
 38				this.reactivate();
 39			},
 40			focus: function(event, data) {
 41				// Auto-activate focused node after 2 seconds
 42				data.node.scheduleAction("activate", 2000);
 43			},
 44			activate: function(event, data) {
 45				var node = data.node;
 46				// Use <a> href and target attributes to load the content:
 47				if( node.data.href ){
 48					// Open target
 49					window.open(node.data.href, node.data.target);
 50					// or open target in iframe
 51//                $("[name=contentFrame]").attr("src", node.data.href);
 52				}
 53			}
 54		});
 55	});
 56	</script>
 57</head>
 58<body class="example">
 59	<h1>Example: URL navigation and iframes</h1>
 60	<p class="description">
 61		This sample shows, how to use fancytree as a navigation menu.<br>
 62		The tree initialization uses <code>&lt;a href='URL', target='TARGET'>title&lt;/a></code>
 63		tags.<br>
 64		The <code>activate</code> handler then uses <code>node.data.href</code>
 65		to open the the pages in the embedded iframe.<br>
 66		Note that the navigation will fallback to standard HTML links,
 67		when JavaScript is disabled.<br>
 68		A focused node will automatically be activated after 2 seconds (use the
 69		keyboard to try this out).<br>
 70		<br>
 71		The [Toggle tree] button in the embedded welcome page also gives an example on
 72		how to access a tree that exists outside the own frame.
 73	</p>
 74	<div>
 75		<label for="skinswitcher">Skin:</label> <select id="skinswitcher"></select>
 76	</div>
 77
 78	<table>
 79	<colgroup>
 80		<col width="300px" valign="top">
 81		<col width="90%">
 82	</colgroup>
 83	<tr>
 84		<td valign="top">
 85			<!-- Add a <div> element where the tree should appear: -->
 86			<div id="tree">
 87			<ul>
 88				<li class="expanded folder">Search engines
 89				<ul>
 90					<li><a href="http://duckduckgo.com" target="contentFrame">DuckDuckGo</a>
 91					<li><a href="http://duckduckgo.com" target="_self">DuckDuckGo (target='_self')</a>
 92					<li><a href="http://duckduckgo.com" target="_top" title="This link replaces the current page">DuckDuckGo (target='_top')</a>
 93					<li><a href="http://www.bing.com" target="contentFrame">Bing</a>
 94					<li><a href="http://www.wolframalpha.com/" target="contentFrame">WolframAlpha</a>
 95				</ul>
 96				<li class="expanded folder">jQuery
 97				<ul>
 98					<li><a href="http://www.jquery.com/" target="contentFrame">jQuery</a>
 99					<li><a href="http://ui.jquery.com/" target="contentFrame">jQuery UI</a>
100					<li><a href="http://api.jquery.com/" target="contentFrame">API browser</a>
101					<li><a href="http://wwwendt.de/tech/fancytree/doc/jsdoc/index.html" target="contentFrame">Fancytree</a>
102				</ul>
103				<li class="expanded folder">Misc
104				<ul>
105					<li><a href="sample-iframe-1.html" target="contentFrame">Welcome</a>
106				</ul>
107			</ul>
108			</div>
109		</td>
110
111		<td>
112			<iframe src="sample-iframe-1.html" name="contentFrame" width="100%" height="500"
113					scrolling="yes" marginheight="0" marginwidth="0" frameborder="0">
114			  <p>Your browser does not support iframes</p>
115			</iframe>
116		</td>
117	</tr>
118	</table>
119
120
121	<!-- Start_Exclude: This block is not part of the sample code -->
122	<hr>
123	<p class="sample-links  no_code">
124		<a class="hideInsideFS" href="https://github.com/mar10/fancytree/">Fancytree project home</a>
125		<a class="hideOutsideFS" href="#">Link to this page</a>
126		<a class="hideInsideFS" href="index.html">Example Browser</a>
127		<a href="#" id="codeExample">View source code</a>
128	</p>
129	<pre id="sourceCode" class="prettyprint" style="display:none"></pre>
130	<!-- End_Exclude -->
131</body>
132</html>