hotfix for readmore.js

This commit is contained in:
Mario Vavti 2016-10-10 14:38:45 +02:00
parent dab3495751
commit 3b422406a9
2 changed files with 22 additions and 4 deletions

View File

@ -2,12 +2,30 @@ diff --git a/library/readmore.js/readmore.js b/library/readmore.js/readmore.js
index 34a624e..51222ce 100644
--- a/library/readmore.js/readmore.js
+++ b/library/readmore.js/readmore.js
@@ -79,7 +79,7 @@
maxHeight: 'none',
overflow: 'hidden'
}).insertAfter(element),
- expandedHeight = el.outerHeight(),
+ expandedHeight = 100 + '%',
cssMaxHeight = parseInt(el.css({maxHeight: ''}).css('max-height').replace(/[^-\d\.]/g, ''), 10),
defaultHeight = element.data('defaultHeight');
@@ -102,7 +102,7 @@
var resizeBoxes = debounce(function() {
$('[data-readmore]').each(function() {
var current = $(this),
- isExpanded = (current.attr('aria-expanded') === 'true');
+ isExpanded = (current.height() > current.data('collapsedHeight'));
setBoxHeights(current);
@@ -246,7 +246,7 @@
collapsedHeight = $element.data('collapsedHeight');
if ($element.height() <= collapsedHeight) {
- newHeight = $element.data('expandedHeight') + 'px';
+ newHeight = 100 + '%';
+ newHeight = $element.data('expandedHeight');
newLink = 'lessLink';
expanded = true;
}

View File

@ -79,7 +79,7 @@
maxHeight: 'none',
overflow: 'hidden'
}).insertAfter(element),
expandedHeight = el.outerHeight(),
expandedHeight = 100 + '%',
cssMaxHeight = parseInt(el.css({maxHeight: ''}).css('max-height').replace(/[^-\d\.]/g, ''), 10),
defaultHeight = element.data('defaultHeight');
@ -102,7 +102,7 @@
var resizeBoxes = debounce(function() {
$('[data-readmore]').each(function() {
var current = $(this),
isExpanded = (current.attr('aria-expanded') === 'true');
isExpanded = (current.height() > current.data('collapsedHeight'));
setBoxHeights(current);
@ -246,7 +246,7 @@
collapsedHeight = $element.data('collapsedHeight');
if ($element.height() <= collapsedHeight) {
newHeight = 100 + '%';
newHeight = $element.data('expandedHeight');
newLink = 'lessLink';
expanded = true;
}