Lungo.Boot.Section.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * Initialize the <section> element
  3. *
  4. * @namespace Lungo.Boot
  5. * @class Section
  6. *
  7. * @author Javier Jimenez Villar <javi@tapquo.com> || @soyjavi
  8. * @author Guillermo Pascual <pasku@tapquo.com> || @pasku1
  9. */
  10. Lungo.Boot.Section = (function(lng, undefined) {
  11. var ELEMENT = lng.Constants.ELEMENT;
  12. var CLASS = lng.Constants.CLASS;
  13. var ATTRIBUTE = lng.Constants.ATTRIBUTE;
  14. /**
  15. * Initializes all <section>s of the project
  16. *
  17. * @method init
  18. */
  19. var init = function() {
  20. _cacheDOMElements();
  21. lng.Fallback.fixPositionInAndroid();
  22. _initFirstSection();
  23. };
  24. var _initFirstSection = function() {
  25. var section = lng.dom(ELEMENT.SECTION).first().addClass(CLASS.SHOW);
  26. lng.Element.Cache.section = section;
  27. lng.Element.Cache.article = section.children(ELEMENT.ARTICLE + "." + CLASS.ACTIVE);
  28. var section_id = '#' + section.attr(ATTRIBUTE.ID);
  29. lng.Router.History.add(section_id);
  30. };
  31. var _cacheDOMElements = function() {
  32. lng.Element.Cache.asides = lng.dom(ELEMENT.ASIDE);
  33. };
  34. return {
  35. init: init
  36. };
  37. })(Lungo);