window.onload = function跟其他发生冲突怎么修改
下面这段JS跟页面中一个图片轮播的特效发生冲突,怎么修改呢。求各位大神帮忙帮忙。小弟万分感谢。<scripttype="text/javascript">varmt=0;...
下面这段JS跟页面中一个图片轮播的特效发生冲突,怎么修改呢。求各位大神帮忙帮忙。小弟万分感谢。
<script type="text/javascript">
var mt = 0;
window.onload = function () {
var mydiv = document.getElementById("mydiv");
var mt = mydiv.offsetTop;
window.onscroll = function () {
var t = document.documentElement.scrollTop || document.body.scrollTop;
if (t > mt) {
mydiv.style.position = "fixed";
mydiv.style.margin = "0";
mydiv.style.bottom = "0";
}
else {
mydiv.style.margin = "20px 0";
mydiv.style.position = "static";
}
}
}
</script> 展开
<script type="text/javascript">
var mt = 0;
window.onload = function () {
var mydiv = document.getElementById("mydiv");
var mt = mydiv.offsetTop;
window.onscroll = function () {
var t = document.documentElement.scrollTop || document.body.scrollTop;
if (t > mt) {
mydiv.style.position = "fixed";
mydiv.style.margin = "0";
mydiv.style.bottom = "0";
}
else {
mydiv.style.margin = "20px 0";
mydiv.style.position = "static";
}
}
}
</script> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询