@soyjavi 14 лет назад
Родитель
Сommit
486a04891a
3 измененных файлов с 23 добавлено и 13 удалено
  1. 14 6
      examples/test/app/events.js
  2. 5 5
      examples/test/index.html
  3. 4 2
      src/router/Lungo.Router.js

+ 14 - 6
examples/test/app/events.js

@@ -15,16 +15,24 @@ App.Events = (function(lng, undefined) {
     });
     });
 
 
     //SPECIAL
     //SPECIAL
-    $$('section#navigation').on('load', function(event) {
-        console.error('Load #navigation', event);
+    $$('section#sec-1').on('load', function(event) {
+        console.error('section#sec-1 loaded', event);
     });
     });
 
 
-    $$('section#navigation').on('unload', function(event) {
-        console.error('Unload', event);
+    $$('section#sec-2').on('unload', function(event) {
+        console.error('section#sec-2 unloaded', event);
     });
     });
 
 
-    $$('article#authors').on('load', function(event) {
-        console.error('loaded article');
+    $$('section#sec-2').on('load', function(event) {
+        console.error('section#sec-2 loaded', event);
+    });
+
+    $$('article#nav-1').on('load', function(event) {
+        console.error('article#nav-1 loaded', event);
+    });
+
+    $$('article#nav-3').on('unload', function(event) {
+        console.error('article#nav-1 unloaded', event);
     });
     });
 
 
 })(LUNGO);
 })(LUNGO);

+ 5 - 5
examples/test/index.html

@@ -41,7 +41,7 @@
 </head>
 </head>
 
 
 <body class="app">
 <body class="app">
-    <section id="test-1" class="pop">
+    <section id="sec-1" class="pop">
         <header class="extended">
         <header class="extended">
             <nav class="onleft">
             <nav class="onleft">
                 <a href="#kitchen-sink-scroll" data-target="aside" data-icon="home"></a>
                 <a href="#kitchen-sink-scroll" data-target="aside" data-icon="home"></a>
@@ -247,15 +247,15 @@
 
 
         <article id="nav-3" class="list indented">
         <article id="nav-3" class="list indented">
             <div>
             <div>
-                <a href="#test-2" data-target="section" class="button big" data-icon="check">Test 2</a>
-                <a href="#test-2"  class="button big red " data-icon="check">Test 2</a>
-                <a href="#test-2" class="button big green" data-icon="check">Test 2</a>
+                <a href="#sec-2" data-target="section" class="button big" data-icon="check">Test 2</a>
+                <a href="#sec-2"  class="button big red " data-icon="check">Test 2</a>
+                <a href="#sec-2" class="button big green" data-icon="check">Test 2</a>
             </div>
             </div>
         </article>
         </article>
     </section>
     </section>
 
 
 
 
-    <section id="test-2" class="pop">
+    <section id="sec-2" class="pop">
         <header data-title="Auto title centered">
         <header data-title="Auto title centered">
             <nav class="onleft">
             <nav class="onleft">
                 <a href="#back" data-target="section" class="cancel" data-icon="close" data-label="CANCEL"></a>
                 <a href="#back" data-target="section" class="cancel" data-icon="close" data-label="CANCEL"></a>

+ 4 - 2
src/router/Lungo.Router.js

@@ -57,9 +57,11 @@ LUNGO.Router = (function(lng, undefined) {
             var target = lng.Element.Current.section.find(ELEMENT.ARTICLE + article_id);
             var target = lng.Element.Current.section.find(ELEMENT.ARTICLE + article_id);
             if (target.length > 0) {
             if (target.length > 0) {
                 if (_sectionId(current) === _sectionId(target)) {
                 if (_sectionId(current) === _sectionId(target)) {
-                    current.removeClass(CLASS.CURRENT).trigger(TRIGGER.UNLOAD);
+                    //current.removeClass(CLASS.CURRENT).trigger(TRIGGER.UNLOAD);
+                    current.removeClass(CLASS.CURRENT);
                 }
                 }
-                target.addClass(CLASS.CURRENT).trigger(TRIGGER.LOAD);
+                //target.addClass(CLASS.CURRENT).trigger(TRIGGER.LOAD);
+                target.addClass(CLASS.CURRENT);
                 lng.Element.Current.article = target;
                 lng.Element.Current.article = target;
 
 
                 lng.View.Article.switchNavItems(article_id);
                 lng.View.Article.switchNavItems(article_id);