Sfoglia il codice sorgente

You can select if want history (reload) or not

Javi Jimenez Villar 13 anni fa
parent
commit
71e7831a38

+ 3 - 1
example/flexbox.html

@@ -252,7 +252,9 @@
     <script>
         Lungo.init({
             name: 'Flexbox',
-            version: '2.2'//,
+            version: '2.2',
+            history: true
+            //,
             // resources: ['app/sections/list.html']
         });
     </script>

+ 6 - 2
src/boot/Lungo.Boot.Layout.coffee

@@ -16,10 +16,14 @@ Lungo.Boot.Layout = do(lng = Lungo) ->
   Initializes all <section> & <article> of the project
   @method init
   ###
-  init = ->
+  init = (config) ->
     lng.Fallback.fixPositionInAndroid()
 
-    if window.location.hash?.length >= 2 then _initSectionbyUrl() else _initSection()
+    if config?.history? and config.history is true and window.location.hash?.length >= 2
+      do _initSectionbyUrl
+    else
+      do _initSection
+
     _initElement C.QUERY.LIST_IN_ELEMENT, _createListElement
     _initElement C.QUERY.ELEMENT_SCROLLABLE, _scrollFix
 

+ 5 - 5
src/modules/Lungo.Init.coffee

@@ -7,8 +7,8 @@ Instance initializer
 @author Javier Jimenez Villar <javi@tapquo.com> || @soyjavi
 ###
 Lungo.init = (config) ->
-  Lungo.Resource.load config.resources  if config and config.resources
-  Lungo.Boot.Device.init()
-  Lungo.Boot.Events.init()
-  Lungo.Boot.Data.init()
-  Lungo.Boot.Layout.init()
+  Lungo.Resource.load config.resources if config and config.resources
+  do Lungo.Boot.Device.init
+  do Lungo.Boot.Events.init
+  do Lungo.Boot.Data.init
+  Lungo.Boot.Layout.init config