Commit bec3e0ec242a18eb9c1a1b53f2ce594be235bed1
1 parent
0708fbb4
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
fix for comments not scrolling
Showing
2 changed files
with
15 additions
and
2 deletions
Show diff stats
plugins/comment_paragraph/public/comment_paragraph_macro.js
| 1 | var comment_paragraph_anchor; | 1 | var comment_paragraph_anchor; |
| 2 | var lastSelectedArea = []; | 2 | var lastSelectedArea = []; |
| 3 | var original_paragraphs = []; | 3 | var original_paragraphs = []; |
| 4 | +var originalArticleHeight = 0 | ||
| 4 | 5 | ||
| 5 | function setPlusIfZeroComments($){ | 6 | function setPlusIfZeroComments($){ |
| 6 | $('.comment-count').each(function(){ | 7 | $('.comment-count').each(function(){ |
| @@ -15,6 +16,8 @@ jQuery(document).ready(function($) { | @@ -15,6 +16,8 @@ jQuery(document).ready(function($) { | ||
| 15 | if($('.comment_paragraph').size() < 1) | 16 | if($('.comment_paragraph').size() < 1) |
| 16 | return; | 17 | return; |
| 17 | 18 | ||
| 19 | + originalArticleHeight = $('.article-body').height(); | ||
| 20 | + | ||
| 18 | all_paragraphs = $('.comment_paragraph'); | 21 | all_paragraphs = $('.comment_paragraph'); |
| 19 | all_paragraphs.each( function(paragraph) { | 22 | all_paragraphs.each( function(paragraph) { |
| 20 | var paragraph_id = $( all_paragraphs.get(paragraph) ).attr('data-paragraph'); | 23 | var paragraph_id = $( all_paragraphs.get(paragraph) ).attr('data-paragraph'); |
| @@ -66,6 +69,14 @@ jQuery(document).ready(function($) { | @@ -66,6 +69,14 @@ jQuery(document).ready(function($) { | ||
| 66 | <div align="center" class="triangle-right" >Comentar</div>\ | 69 | <div align="center" class="triangle-right" >Comentar</div>\ |
| 67 | </a>'); | 70 | </a>'); |
| 68 | 71 | ||
| 72 | + function resizeArticle(paragraphId){ | ||
| 73 | + var commentHeigh = $('#side_comment_' + paragraphId).height(); | ||
| 74 | + if(commentHeigh > 0){ | ||
| 75 | + $('.article-body').height(originalArticleHeight + commentHeigh + 50); | ||
| 76 | + }else{ | ||
| 77 | + $('.article-body').height(originalArticleHeight); | ||
| 78 | + } | ||
| 79 | + } | ||
| 69 | 80 | ||
| 70 | $('.side-comments-counter').click(function(){ | 81 | $('.side-comments-counter').click(function(){ |
| 71 | var paragraphId = $(this).data('paragraph'); | 82 | var paragraphId = $(this).data('paragraph'); |
| @@ -74,11 +85,9 @@ jQuery(document).ready(function($) { | @@ -74,11 +85,9 @@ jQuery(document).ready(function($) { | ||
| 74 | if($('.comment-paragraph-slide-left').size()==0){ | 85 | if($('.comment-paragraph-slide-left').size()==0){ |
| 75 | $('.article-body').addClass('comment-paragraph-slide-left'); | 86 | $('.article-body').addClass('comment-paragraph-slide-left'); |
| 76 | $('#side_comment_' + paragraphId).show(); | 87 | $('#side_comment_' + paragraphId).show(); |
| 77 | - $('#side_comment_' + paragraphId).find().show(); | ||
| 78 | }else{ | 88 | }else{ |
| 79 | $('.article-body').removeClass('comment-paragraph-slide-left'); | 89 | $('.article-body').removeClass('comment-paragraph-slide-left'); |
| 80 | $('.side-comment').hide(); | 90 | $('.side-comment').hide(); |
| 81 | - $('.side-comment').find().hide(); | ||
| 82 | } | 91 | } |
| 83 | $('#comment-bubble').hide(); | 92 | $('#comment-bubble').hide(); |
| 84 | //Loads the comments | 93 | //Loads the comments |
| @@ -89,6 +98,7 @@ jQuery(document).ready(function($) { | @@ -89,6 +98,7 @@ jQuery(document).ready(function($) { | ||
| 89 | }).done(function() { | 98 | }).done(function() { |
| 90 | var button = $('#page-comment-form-' + paragraphId + ' a').get(0); | 99 | var button = $('#page-comment-form-' + paragraphId + ' a').get(0); |
| 91 | button.click(); | 100 | button.click(); |
| 101 | + resizeArticle(paragraphId); | ||
| 92 | }); | 102 | }); |
| 93 | }); | 103 | }); |
| 94 | 104 | ||
| @@ -109,6 +119,7 @@ jQuery(document).ready(function($) { | @@ -109,6 +119,7 @@ jQuery(document).ready(function($) { | ||
| 109 | }).done(function() { | 119 | }).done(function() { |
| 110 | var button = $('#page-comment-form-' + paragraphId + ' a').get(0); | 120 | var button = $('#page-comment-form-' + paragraphId + ' a').get(0); |
| 111 | button.click(); | 121 | button.click(); |
| 122 | + resizeArticle(paragraphId); | ||
| 112 | }); | 123 | }); |
| 113 | }); | 124 | }); |
| 114 | 125 |
plugins/comment_paragraph/public/style.css
| @@ -242,6 +242,8 @@ div[class^='comment-paragraph-loading-'] { | @@ -242,6 +242,8 @@ div[class^='comment-paragraph-loading-'] { | ||
| 242 | 242 | ||
| 243 | .comment-paragraph-group-comments{ | 243 | .comment-paragraph-group-comments{ |
| 244 | position: absolute; | 244 | position: absolute; |
| 245 | + background-color: white; | ||
| 246 | + z-index: 9999; | ||
| 245 | } | 247 | } |
| 246 | 248 | ||
| 247 | .comment-paragraph-slide-left{ | 249 | .comment-paragraph-slide-left{ |