admin管理员组文章数量:1130349
It is a well discussed problem, but I can't find the issue (I've been researching it for days now); Uncaught ReferenceError: jQuery is not defined
jQuery seems not te be loaded within my custom template. So I pass the jQuery argument when enqueuing the script:
// Load scripts in header
function html5blank_header_scripts() {
wp_register_script('scripts', get_template_directory_uri() .
'/assets/scripts_head.js', array('jquery'), '1.2', true);
wp_enqueue_script('scripts');
}
I use jQuery in non-conflicting mode and it is wrapped in document ready function:
jQuery( document ).ready( function( $ ) {
// case carousel
jQuery(document).on('ready', function() {
jQuery('.slider_sector').slick({
infinite: true,
speed: 600,
slidesToShow: 1,
slidesToScroll: 1,
accessibility: true,
centerMode: true,
lazyLoad: 'ondemand',
variableWidth: true
});
});
});
When including jQuery manually by inserting <script src=".11.2.min.js" type="text/javascript"></script> in the head, the error goes away.
I should not have to load jQuery manually if array('jquery') is passed while loading right?
It is a well discussed problem, but I can't find the issue (I've been researching it for days now); Uncaught ReferenceError: jQuery is not defined
jQuery seems not te be loaded within my custom template. So I pass the jQuery argument when enqueuing the script:
// Load scripts in header
function html5blank_header_scripts() {
wp_register_script('scripts', get_template_directory_uri() .
'/assets/scripts_head.js', array('jquery'), '1.2', true);
wp_enqueue_script('scripts');
}
I use jQuery in non-conflicting mode and it is wrapped in document ready function:
jQuery( document ).ready( function( $ ) {
// case carousel
jQuery(document).on('ready', function() {
jQuery('.slider_sector').slick({
infinite: true,
speed: 600,
slidesToShow: 1,
slidesToScroll: 1,
accessibility: true,
centerMode: true,
lazyLoad: 'ondemand',
variableWidth: true
});
});
});
When including jQuery manually by inserting <script src=".11.2.min.js" type="text/javascript"></script> in the head, the error goes away.
I should not have to load jQuery manually if array('jquery') is passed while loading right?
本文标签: wp enqueue scriptUncaught ReferenceError jQuery is not defined
版权声明:本文标题:wp enqueue script - Uncaught ReferenceError: jQuery is not defined 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749040879a2307116.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论