I liked the idea of mathjax lazyload. I tried and it is fast. The only problem is the equations are rendering when in view port which is reducing user experience. If the equations are getting rendered when 500 px plus below the view port, then it would be fine especially on mobiles as the page is really lengthy. Is there anyway, that can be adjusted?
MathJax = {loader: {load: ['ui/lazy']},startup: {ready() {//// Adjust the lazy observer to have a margin of 500px so expressions// will be typeset a little when they are still a little bit away from being seen.//MathJax.startup.extendHandler(handler => {handler.documentClass = class extends handler.documentClass {constructor(...args) {super(...args);this.lazyObserver = new IntersectionObserver(this.lazyObserve.bind(this), {rootMargin: '500px'});}};return handler;}, 100);//// Do the regular startup.//MathJax.startup.defaultReady();}}};
window.MathJax = {loader: {load: ['ui/lazy']},
tex: {inlineMath: [["$","$"],["\\(","\\)"]]},svg: {
scale: 0.9},options: {renderActions: {addMenu: [],checkLoading: []},ignoreHtmlClass: 'tex2jax_ignore',processHtmlClass: 'tex2jax_process'},startup: {
typeset: false,
ready: function () {var SVG = MathJax._.output.svg_ts.SVG;var percent = MathJax._.util.lengths.percent;SVG.prototype.setScale = function (node) {if (this.options.scale !== 1) {this.adaptor.setStyle(node, 'fontSize', percent(this.options.scale));}}
//// Adjust the lazy observer to have a margin of 500px so expressions// will be typeset a little when they are still a little bit away from being seen.//MathJax.startup.extendHandler(handler => {handler.documentClass = class extends handler.documentClass {constructor(...args) {super(...args);this.lazyObserver = new IntersectionObserver(this.lazyObserve.bind(this), {rootMargin: '500px'});}};return handler;}, 100);
MathJax.startup.defaultReady();}}};(function () {var script = document.createElement('script');script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js';script.async = true;document.head.appendChild(script);})();
--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/27557c30-42da-4551-9471-af777140f0e3n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/058e86be-100b-487b-9261-80ad62460059n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/f07b252f-5023-41eb-89da-1eeed16059b4n%40googlegroups.com.