Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/404.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 脚本不';在Bootstrap4主题中不工作_Javascript_Jquery_Twitter Bootstrap_Bootstrap 4 - Fatal编程技术网

Javascript 脚本不';在Bootstrap4主题中不工作

Javascript 脚本不';在Bootstrap4主题中不工作,javascript,jquery,twitter-bootstrap,bootstrap-4,Javascript,Jquery,Twitter Bootstrap,Bootstrap 4,我在我的网站上添加了一个scroll to top脚本(使用Bootstrap 4开发),但它不起作用。然而,这个脚本在使用Bootstrap3开发的同一个网站上工作。我认为引导版本出现了错误,但不幸的是我找不到问题 $('.toTop')。在('click',函数(事件){ event.preventDefault(); $('html,body')。设置动画({ 滚动顶部:0 }“慢”); }); 控制台日志: JQMIGRATE: Migrate is installed, vers

我在我的网站上添加了一个scroll to top脚本(使用Bootstrap 4开发),但它不起作用。然而,这个脚本在使用Bootstrap3开发的同一个网站上工作。我认为引导版本出现了错误,但不幸的是我找不到问题


$('.toTop')。在('click',函数(事件){
event.preventDefault();
$('html,body')。设置动画({
滚动顶部:0
}“慢”);
});
控制台日志:

JQMIGRATE: Migrate is installed, version 1.4.1
smooth.js:2 Uncaught TypeError: $ is not a function
    at smooth.js:2
(anonymous) @ smooth.js:2
这是一个有主题的Wordpress网站,是用Bootstrap4开发的

jQuery通过以下方式从finctions.php加载:

// include custom jQuery
function shapeSpace_include_custom_jquery() {
    wp_deregister_script('jquery');
    wp_enqueue_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js', array(), null, true);
}
add_action('wp_enqueue_scripts', 'shapeSpace_include_custom_jquery');

删除dollar并尝试保留
jQuery。(.toTop”)
..@MadhuNair不幸的是什么都没有发生。我尝试了一些替代jQuery,但没有用。为什么要先取消注册脚本?您的平滑滚动脚本在哪里注册?