events.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. App.Events = (function(lng, undefined) {
  2. lng.ready(function(){
  3. console.error('LUNGO.js is ready...');
  4. App.Services.mockProfiles();
  5. });
  6. //Toggle Aside
  7. //Event on dinamic items
  8. lng.dom('#list-auto').on('swipeLeft', 'li', function(event){
  9. console.error(this, event, 'swipe');
  10. });
  11. //List.Append & List.prepend
  12. lng.dom('#test header a.red').tap(function(event) {
  13. var param = {
  14. el: '#list-added',
  15. template: 'profile-tmp',
  16. data: {
  17. name: 'Javier Jimenez Villar',
  18. description: '@soyjavi'
  19. }
  20. };
  21. if ($$(this).hasClass('prepend')) {
  22. lng.View.Template.List.append(param);
  23. } else {
  24. lng.View.Template.List.prepend(param);
  25. }
  26. });
  27. //Scroll.Append & Scroll.Last // Scroll.first & Scroll.last
  28. lng.dom('#test header a.green').tap(function(event) {
  29. lng.View.Scroll.append('scroll-horizontal', '<span>1</span>');
  30. lng.View.Scroll.first('scroll-horizontal');
  31. lng.View.Scroll.append('scroll-vertical', '<span>1</span>');
  32. lng.View.Scroll.last('scroll-vertical');
  33. });
  34. //Remove Item >> Scroll.refresh
  35. lng.dom('article#list-added li').tap(function(event) {
  36. $$(this).remove();
  37. lng.View.Scroll.refresh('list-added');
  38. });
  39. //SPECIAL
  40. $$('section#test').on('load', function(event) {
  41. console.error('Load #navigation', event);
  42. lng.Router.article('#next', '#files');
  43. });
  44. $$('section#next').on('unload', function(event) {
  45. console.error('Unload', event);
  46. });
  47. })(LUNGO);