Plugin scripts are loaded before jQuery
-
Hi 10Web, potential bug report here. In QA’ing a site , I noticed a console error that jQuery isn’t defined. The cause of this error is from the Photo Gallery plugin inserting javascript right after the <title> tag. At this point, jQuery isn’t loaded yet. I enabled the option to “only load photo gallery scripts” on pages where a photo gallery is needed, but this didn’t change anything. We don’t have anything that would cause this. Offending code below:
<script> var bwg_admin_ajax = 'https://anterra.com/wp-admin/admin-ajax.php?action=shortcode_bwg'; var bwg_ajax_url = 'https://anterra.com/wp-admin/admin-ajax.php?action'; var bwg_plugin_url = 'https://anterra.com/wp-content/plugins/photo-gallery'; jQuery(document).ready(function () { bwg_check_ready = function () {} jQuery(document).keyup(function(e) { if ( e.keyCode == 27 ) { bwg_remove_loading_block(); } }); }); // Set shortcode popup dimensions. function bwg_set_shortcode_popup_dimensions() { var H = jQuery(window).height(), W = jQuery(window).width(); jQuery("#TB_title").hide().first().show(); // New var tbWindow = jQuery('#TB_window'); if (tbWindow.size()) { tbWindow.width(W).height(H); jQuery('#TB_iframeContent').width(W).height(H); tbWindow.attr('style', 'top:'+ '0px !important;' + 'left:' + '0px !important;' + 'margin-left:' + '0;' + 'z-index:' + '1000500;' + 'max-width:' + 'none;' + 'max-height:' + 'none;' + '-moz-transform:' + 'none;' + '-webkit-transform:' + 'none' ); } // Edit var tbWindow = jQuery('.mce-window[aria-label="Photo Gallery"]'); if (tbWindow.length) { // To prevent wp centering window with old sizes. setTimeout(function() { tbWindow.width(W).height(H); tbWindow.css({'top': 0, 'left': 0, 'margin-left': '0', 'z-index': '1000500'}); tbWindow.find('.mce-window-body').width(W).height(H); }, 10); } } // Create loading block. function bwg_create_loading_block() { jQuery('body').append('<div class="loading_div" style="display:block; width: 100%; height: 100%; opacity: 0.6; position: fixed; background-color: #000000; background-image: url('+ bwg_plugin_url +'/images/spinner.gif); background-position: center; background-repeat: no-repeat; background-size: 50px; z-index: 1001000; top: 0; left: 0;"></div>'); } // Remove loading block. function bwg_remove_loading_block() { jQuery(".loading_div", window.parent.document).remove(); jQuery('.loading_div').remove(); } </script>
The page I need help with: [log in to see the link]
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Plugin scripts are loaded before jQuery’ is closed to new replies.