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