ソースを参照

Set correct height to articles in section

@soyjavi 14 年 前
コミット
25151f71af
1 ファイル変更20 行追加1 行削除
  1. 20 1
      src/boot/Lungo.Boot.Section.js

+ 20 - 1
src/boot/Lungo.Boot.Section.js

@@ -52,7 +52,11 @@ LUNGO.Boot.Section = (function(lng, undefined) {
     };
 
     var _initArticles = function(section) {
-        var first_article = section.children(SELECTORS.ARTICLE).first();
+        var articles = section.children(SELECTORS.ARTICLE);
+
+        _calculateArticleHeight(section, articles);
+
+        var first_article = articles.first();
         first_article.addClass(ACTIVE_CLASS);
 
         var first_article_id = first_article.attr('id');
@@ -60,6 +64,21 @@ LUNGO.Boot.Section = (function(lng, undefined) {
         lng.View.Article.showReferenceLinks(section_id, first_article_id);
     };
 
+    var _calculateArticleHeight = function(section, articles) {
+        var footer =  section.children('footer');
+        var header = section.children('header');
+
+        var articles_height = window.innerHeight;
+        if (footer.length > 0) {
+            articles_height -= footer.height();
+        }
+        if (header.length > 0) {
+            articles_height -= header.height();
+        }
+
+        articles.style('height', articles_height + 'px');
+    }
+
     var _initAllAsides = function() {
         lng.dom('aside').addClass('show');
     };