Toggle navigation
Run LIVE DEMO
Show CODE
LIVE DEMO PAGE
Updated: 19.06.18 11:03
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 added through markup --> <div id="View1" class="text-center"> <h1>You are on view 1/3</h1> <p>This is the first view in the demo.</p> <a class="btn btn-default" href="#View3">Back</a> <a class="btn btn-default" href="#View2">Next</a> </div> <!-- View1 added through markup --> <div id="View2" class="text-center"> <h1>You are on view 2/3</h1> <p>This is view 2 of 3 in this demo.</p> <a class="btn btn-default" href="#View1">Back</a> <a class="btn btn-default" href="#View3">Next</a> </div> <!-- View3 added through markup --> <div id="View3" class="text-center"> <h1>You are on view 3/3</h1> <p>You are on the last view in this demo</p> <a class="btn btn-default" href="#View2">Back</a> <a class="btn btn-default" href="#View1">Next</a> </div> <script> $(function() { // Initialize app on a DOM container element var $app = $("#AppContainer").smartapp2(); // Register a view on URL #View1 (will be default view, as it is registered first) $app.createView("View1", $("#View1")); // Register a view on URL #View2 $app.createView("View2", $("#View2")); // Register a view on URL #View3 $app.createView("View3", $("#View3")); // Run the application $app.run(); }); </script> </body> </html>