Use readmore.js for blockquotes
-
Hi!
I'm migrating from another forum to hosted nodeBB but need som help with one important feature.
We have some users that make long posts, and when someone quotes, the quote become equally long, this makes it cumbersome to scroll throught the topic.
Other forums solve this by fading out, and a clickable "read more..." text that expands the big quotes.
I was hoping to do this as well, but am failing. Mainly I hope due to my lacking knowledge in javascript.
So I tried uploading
readmore.min.js
to /assets/uploads/... and added the following to custon javascript:function onLoad() { require(['/assets/uploads/readmore.min.js']); console.log('yeah it works'); console.log($('blockquote')); $('blockquote').readmore(); } $(document).ready(onLoad); $(window).on('action:ajaxify.end', onLoad);
This gives me the following output in the console:
Any help is much appreciated!
-
Did you try with this?
function onLoad() { require(['/assets/uploads/readmore.min.js'], function () { console.log('yeah it works'); console.log($('blockquote')); $('blockquote').readmore(); }); } $(document).ready(onLoad); $(window).on('action:ajaxify.end', onLoad);
Copyright © 2024 NodeBB | Contributors