• Resolved nguyenthixuan151

    (@nguyenthixuan151)


    Hi,
    I get this error in console when optimize HTML option is checked
    https://imgur.com/j04Z1JT and product zoom doesn’t work.
    I tried to add scripts-dist.js and jquery.js to exclude js but nothing better.
    I’m using shopkeeper theme
    Please help me to check it?

    The page I need help with: [log in to see the link]

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    If the problem only occurs when “optimize HTML” is active, then we should look at where the HTML is different (broken), probably for the div with class="fresco zoom". Could you copy/paste your optimized HTML to pastebin.com or to a gist.github.com and provide me the link?

    Thread Starter nguyenthixuan151

    (@nguyenthixuan151)

    Hi,
    Here is optimized HTML of my product page
    https://gist.github.com/nguyenthixuan151/4f3ada27d1114d65e3251b3caa3afa59

    Thanks for your quickly response!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, problem is with a space gone missing;

    
    <adata-fresco-group="product-gallery" data-fresco-options="

    should obviously be

    
    <a data-fresco-group="product-gallery" data-fresco-options="

    If I’m not mistaking this is fixed in the development version of AO which you can download from github, could you give that a try?

    frank
    frank

    Thread Starter nguyenthixuan151

    (@nguyenthixuan151)

    I’ll try and give you result. Thank you!

    Thread Starter nguyenthixuan151

    (@nguyenthixuan151)

    Hi, it’s not better to me ??

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    hmm … did you you clear your page caches?

    Thread Starter nguyenthixuan151

    (@nguyenthixuan151)

    Sorry for late response. I cleared all browser cache, plugin cache but still see <adata-fresco-group in page source.
    Thanks for your help!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    confirmed. problem is the HTML going in is … ugly, throwing off the (probably somewhat naive) HTML optimizer;

    	                	<a 
    
    		                	data-fresco-group="product-gallery" 
    		                	data-fresco-options="ui: 'outside', thumbnail: 'https://pckasseintegration.inbusinessclients.no/wp-content/uploads/pckasse_upload/Chenille_1503749725-570x466.png'" 
    		                	data-fresco-group-options="overflow: true, thumbnails: 'vertical', onClick: 'close'" 
    		                	data-fresco-caption="" 
    
    		                	class="fresco zoom" 
    
    		                	href="https://pckasseintegration.inbusinessclients.no/wp-content/uploads/pckasse_upload/Chenille_1503749725.png"
    
    		                	>

    which after HTML optimization becomes:

    <adata-fresco-group="product-gallery"
    data-fresco-options="ui: 'outside', thumbnail: 'https://pckasseintegration.inbusinessclients.no/wp-content/uploads/pckasse_upload/Chenille_1503749725-570x466.png'"
    data-fresco-group-options="overflow: true, thumbnails: 'vertical', onClick: 'close'"
    data-fresco-caption=""class="fresco zoom"href="https://pckasseintegration.inbusinessclients.no/wp-content/uploads/pckasse_upload/Chenille_1503749725.png">

    So that’s not good. You could either disable HTML optimization (it’s the least important one anyhow) or you could use this code-snippet that seems to fix things for me;

    
    add_filter('autoptimize_html_after_minify','fresco_zoom_fixer');
    function fresco_zoom_fixer($in) {
    	return preg_replace_callback(
                    '/<a(data[^>]*)>/',
                    create_function(
                        '$matches',
                        '
    						$_tmp="<a $matches[1]>";
    						$_tmp=str_replace("\n"," ",$_tmp);
    						$_tmp=str_replace("\"class","\" class",$_tmp);
    						$_tmp=str_replace("\"href","\" href",$_tmp);
    						return $_tmp;
    					'
                    ),
                    $in
                );
    }

    hope this helps,
    frank

    Thread Starter nguyenthixuan151

    (@nguyenthixuan151)

    The filter works. Thanks for your support so much. Very quick ??

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    happy it works. did that fresco zoom come with your theme, or is it part of a plugin?

    Thread Starter nguyenthixuan151

    (@nguyenthixuan151)

    It’s come with theme shopkeeper.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    hey @nguyenthixuan151;
    this commit should fix the problem in the HTML minifier proper, meaning you could remove the code snippet. could you test?

    thanks!
    frank

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Product image zoom does not work when check to optimize html – theme shopkeeper’ is closed to new replies.