Autoptimize css fix
-
Hello, I have a problem with autoptimize, cache growns too fast, but if i turn off aggregate inline CSS and JS site grid and styling get lost. What did I need to do?
-
Well, let’s start with just turning of “aggregate inline JS” maybe? 🙂
Nope, but if I turn off aggregate inline css with on “aggregate inline js” it works, but only with checked next option – I don’t know how it names in eng:
https://i.imgur.com/Jn1niq7.pngSomething like: Let Autoptimize extract JS from HTML (…).
But this will be cause for fast growning cache… What can I do next?
OK, so what happens if the only change you make is unchecking that 3rd JS optimization option (extract JS from HTML)?
And when “extract JS from HTML” is unchecked, what JS error(s) do you see on the browser console?
Yup, jQuery is not defined
<script type="text/javascript">jQuery(document).ready(function(){ jQuery(".ult_modal-body iframe").each(function(index, element) { var w = jQuery(this).attr("width"); var h = jQuery(this).attr("height"); var st = '<style type="text/css" id="modal-css">'; st += "#"+jQuery(this).closest(".ult-overlay").attr("id")+" iframe{width:"+w+"px !important;height:"+h+"px !important;}"; st += ".fluid-width-video-wrapper{padding: 0 !important;}"; st += "</style>"; jQuery("head").append(st); }); });</script>and there:
<script type="text/javascript"> (function($) { $('head').append('<style type="text/css">#layout.dfd-blog-loop .dfd-blog {margin: -10px;}#layout.dfd-blog-loop .dfd-blog .post .cover {padding: 10px;}#layout.dfd-blog-loop .dfd-blog-wrap .dfd-blog-masonry.dfd-smart-grid .post .dfd-blog-heading-wrap, #layout.dfd-blog-loop .dfd-blog-wrap .dfd-blog-fitRows.dfd-smart-grid .post .dfd-blog-heading-wrap {top: 10px;}#layout.dfd-blog-loop .dfd-blog-wrap .dfd-blog-masonry.dfd-smart-grid .post .entry-content, #layout.dfd-blog-loop .dfd-blog-wrap .dfd-blog-fitRows.dfd-smart-grid .post .entry-content {bottom: 10px;}#layout.dfd-blog-loop .dfd-blog-wrap .dfd-blog-masonry.dfd-smart-grid .post .dfd-blog-heading-wrap, #layout.dfd-blog-loop .dfd-blog-wrap .dfd-blog-fitRows.dfd-smart-grid .post .dfd-blog-heading-wrap, #layout.dfd-blog-loop .dfd-blog-wrap .dfd-blog-masonry.dfd-smart-grid .post .entry-content, #layout.dfd-blog-loop .dfd-blog-wrap .dfd-blog-fitRows.dfd-smart-grid .post .entry-content {left: 10px; right: 10px;}</style>'); })(jQuery); </script>in that case try adding
js/jquery/jquery.js(assuming you’re using the stock WordPress jQuery) to the comma-separated JS optimization exclusion list?It’s already there, and still jQuery not defined
-
This reply was modified 7 years, 3 months ago by
kornixpl.
so then you’re not using stock wordpress jquery? maybe check the page source of an un-optimized page to see how jquery is loaded normally? and make sure it is not asynced or deferred 🙂
Okay I get it. It was problem with transfer jQuery to footer, now works well, thanks for help! 🙂
happy it works kornixpl, feel free to leave a review of the plugin and support here! 🙂
-
This reply was modified 7 years, 3 months ago by
The topic ‘Autoptimize css fix’ is closed to new replies.