This question has been answered by multiple community members. See the first response.
<?php
/**
* addReadMore Snippet
*
* DESCRIPTION
*
* This Snippet add the readmore.js to the bottom of the page as well as the script that
* targets which div to run the script on.
*/
$modx->regClientScript('assets/js/readmore.min.js');
$modx->regClientHTMLBlock('
<!--BEGIN READMORE-->
<script>
$('article').readmore({
moreLink: '<a href="#">Read more ></a>',
speed: 500,
maxHeight: 200,
afterToggle: function(trigger, element, expanded) {
if(! expanded) { // The "Close" link was clicked
$('html, body').animate( { scrollTop: element.offset().top }, {duration: 1000 } );
}
}
});
</script>
<!--END READMORE-->');$js ='<script>your javascript code</script>'; $modx->regClientScript($js);