File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
openlibrary/plugins/openlibrary/js Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -53,9 +53,15 @@ export class ReadMoreComponent {
5353
5454 reset ( ) {
5555 this . fullHeight = this . $content . scrollHeight ;
56+ if ( this . $readMoreButton && this . $readMoreButton . offsetHeight ) {
57+ this . readMoreHeight = this . $readMoreButton . offsetHeight ;
58+ }
59+ const collapsedHeight = this . collapsedHeight ;
60+ const readMoreButtonHeight = this . readMoreHeight || 0 ;
61+
5662 // Fudge factor to account for non-significant read/more
5763 // (e.g missing a bit of padding)
58- if ( this . $content . scrollHeight <= ( this . collapsedHeight + 1 ) ) {
64+ if ( this . fullHeight <= ( collapsedHeight + readMoreButtonHeight + 1 ) ) {
5965 this . expand ( ) ;
6066 this . $container . classList . add ( 'read-more--unnecessary' ) ;
6167 } else {
You can’t perform that action at this time.
0 commit comments