可以在HTML的底部使用多个Script标签吗?
这是我正在使用的脚本。
我想知道他们是否会减慢速度?
或会导致任何技术问题?
有什么方法可以将它们合并为一个文件并将其链接到我的页面?还是这不是一个好主意?
var $ menuham = $(“。menuham”);
$ menuham.on(“ click”,function(e){
$(“。overlay”)。fadeToggle(200);
$(“ h1.brandcolor”)。toggleClass(“ brandcolorw”);;
$ menuham.toggleClass(“ is-active”);
//做其他事情,例如打开/关闭菜单
});
var $ projectinfo = $(“。projectinfo”);
$ projectinfo.on(“ click”,function(e){
$ projectinfo.toggleClass(“ is-active”);
//做其他事情,例如打开/关闭菜单
});
$(document).ready(function(){
$ {window).scroll(function(){
如果($(this).scrollTop()> 100){
$('#scroll')。fadeIn();
}其他{
$('#scroll')。fadeOut();
}
});
$('#scroll')。click(function(){
$(“ html,body”)。animate({scrollTop:0},250);
返回false;
});
});
//当用户滚动页面时,执行myFunction
window.onscroll = function(){myFunction()};
函数myFunction(){
var winScroll = document.body.scrollTop || document.documentElement.scrollTop;
var height = document.documentElement.scrollHeight-document.documentElement.clientHeight;
var scrolled =(winScroll / height)* 100;
document.getElementById(“ myBar”)。style.width =滚动+“%”;
}