Readmore.js
Readmore.js copied to clipboard
getBoundingClientRect needs to be parsed
I came on a bug that only occurs en chrome desktop mode, brave is ok, emulation mobile is ok too...
Here is the line on the dist file that needs to be corrected :
481 var expanded = parseInt(element.getBoundingClientRect().height) <= element.readmore.collapsedHeight;
parseInt fix the issue. Else the value returned by this function is not equal or less to collapsedHeight (240.000001453 > 240).
Hope it helps.
Got the exact same issue in Chrome (98.0.4758.102), the block won't expand because of:
console.log(element.getBoundingClientRect().height, element.readmore.collapsedHeight)
// 200.00001525878906 200
Another suggestion is to take heightMargin option into account when defining var expanded on line 481:
var expanded = element.getBoundingClientRect().height <= element.readmore.collapsedHeight + element.readmore.heightMargin;