framework7rails 4.0.0 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,48 @@
1
+ // Initialize your app
2
+ var myApp = new Framework7();
3
+
4
+ // Export selectors engine
5
+ var $$ = Dom7;
6
+
7
+ // Add view
8
+ var mainView = myApp.addView('.view-main', {
9
+ // Because we use fixed-through navbar we can enable dynamic navbar
10
+ dynamicNavbar: true
11
+ });
12
+
13
+ // Callbacks to run specific code for specific pages, for example for About page:
14
+ myApp.onPageInit('about', function (page) {
15
+ // run createContentPage func after link was clicked
16
+ $$('.create-page').on('click', function () {
17
+ createContentPage();
18
+ });
19
+ });
20
+
21
+ // Generate dynamic page
22
+ var dynamicPageIndex = 0;
23
+ function createContentPage() {
24
+ mainView.router.loadContent(
25
+ '<!-- Top Navbar-->' +
26
+ '<div class="navbar">' +
27
+ ' <div class="navbar-inner">' +
28
+ ' <div class="left"><a href="#" class="back link"><i class="icon icon-back"></i><span>Back</span></a></div>' +
29
+ ' <div class="center sliding">Dynamic Page ' + (++dynamicPageIndex) + '</div>' +
30
+ ' </div>' +
31
+ '</div>' +
32
+ '<div class="pages">' +
33
+ ' <!-- Page, data-page contains page name-->' +
34
+ ' <div data-page="dynamic-pages" class="page">' +
35
+ ' <!-- Scrollable page content-->' +
36
+ ' <div class="page-content">' +
37
+ ' <div class="content-block">' +
38
+ ' <div class="content-block-inner">' +
39
+ ' <p>Here is a dynamic page created on ' + new Date() + ' !</p>' +
40
+ ' <p>Go <a href="#" class="back">back</a> or go to <a href="services.html">Services</a>.</p>' +
41
+ ' </div>' +
42
+ ' </div>' +
43
+ ' </div>' +
44
+ ' </div>' +
45
+ '</div>'
46
+ );
47
+ return;
48
+ }