Support » Plugin: EWWW Image Optimizer » Adding lazyload class inside a script

  • Resolved Gal Baras

    (@galbaras)


    I had a script with this line in it:

    jQuery('#logo a').append('<img src="'+get_logo_image_src()+'" alt="Personal Growth Web" />');

    The plugin changed it to:

    jQuery('#logo a').append('<img src="'+get_logo_image_src()+'" alt="Personal Growth Web" data-src="'+get_logo_image_src()+" class="lazyload" /><noscript><img src="'+get_logo_image_src()+'" alt="Personal Growth Web" /></noscript>');

    Which resulted in “Uncaught SyntaxError: missing ) after argument list” error in the browser console.

    Looks like the plugin is (somewhat blindly) targeting the string “<img” and inserting the class incorrectly.

    I’ve changed this line into this, and the problem was gone:

    jQuery('#logo a').append('<' + 'img src="'+get_logo_image_src()+'" alt="Personal Growth Web" />');

    • This topic was modified 7 months ago by Gal Baras.
    • This topic was modified 7 months ago by Gal Baras.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Adding lazyload class inside a script’ is closed to new replies.