Toggle navigation
Run LIVE DEMO
Show CODE
LIVE DEMO PAGE
Updated: 19.06.18 11:05
Basic example
<!DOCTYPE html> <html> <head> <title>A very simple smartapp2.js example</title> <!-- jQuery --> <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script> <!-- Bootstrap --> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" /> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <!-- Smartapp --> <script src="https://smartapp.ikx.no/downloads/jquery.smartapp2.js"></script> </head> <body> <div id="AppContainer"></div> <!-- View1 markup --> <div id="View1" class="text-center"> <h3>This is view 1</h3> <p>The menu control will be loaded below:</p> <div data-loadcontrol="Menu"></div> <p>By using conrtols you can share common parts between several views.</p> <a href="#View2">Go to view 2</a> </div> <!-- View2 markup --> <div id="View2" class="text-center"> <h3>This is view 2</h3> <p>The same menu control has been included below here:</p> <div data-loadcontrol="Menu"></div> <a href="#View1">Go back to view 1</a> </div> <!-- Menu markup --> <div id="Menu"> <nav class="well well-sm">This is the menu part</nav> </div> <script> $(function() { // Initialize app on a DOM container element var $app = $("#AppContainer").smartapp2(); // Register a view on route #Hello (will be default view, as it is registered first) $app.createView("View1", $("#View1")); $app.createView("View2", $("#View2")); $app.createControl("Menu", $("#Menu")); // Run the application $app.run(); }); </script> </body> </html>