任何人都可以帮我添加一个适当的fadeIn fadeOut到下面的代码吗?有一些我缺少的东西。我正在使用这个onscroll在页面顶部取一个div并在滚动时将其用作修复菜单。
<script>
var windowWidth = $(window ).width();
if(windowWidth>1580){
$(document).ready(function(){
document.onscroll = function() {
if (window.pageYOffset >= 1400){
$(".main2").css({position: "fixed", left: "0", top:"20px", background:"white"});
$(".main2").css({"width":"290"});
$(".main2").css({"min-height":"300"});
$(".main2").css({"max-height":"600"});
$(".main2").css({"overflow":"hidden"});
$(".main2").css("zIndex", "9999");
$(".main2").css("font-size", "9");
$(".immagine1").css("display","none");
$(".share").css({position: "fixed", right: "0", top: "20px", background:"white"});
$(".share").css({"width":"120"});
$(".share").css({"height":"100"});
}
else {
$(".main2").css({position: "", right: "", top: "", background:""});
$(".main2").css({"width":""});
$(".main2").css({"min-height":""});
$(".main2").css({"max-height":""});
$(".main2").css({"overflow":""});
$(".main2").css("zIndex", "");
$(".main2").css("font-size", "");
$(".immagine1").css("display","");
$(".share").css({position: "", right: "", top: "", background:""});
$(".share").css({"width":""});
$(".share").css({"height":""});
}
}
})};
</script>