[英]Keeping second variable value “one behind” first variable value in javascript
[英]The value of the variable from the first function is not reflected in the value of the second
我正在写信给您一个事实,即heigths变量的“ .bottom_down i”函数给出的值不会反映为“ .bottom_up i”。 请帮忙,我是Js的新手
var heights = 0; $('.bottom_up i').click(function () { heights = heights - window.innerHeight; window.scrollTo(300, heights); alert('Bottom_up ='+ heights); $('.bottom_down').animate({opacity: '1'}, 1200); if (heights = window.innerHeight){ $('.bottom_up').animate({opacity: '0'}, 1200); }else{ $('.bottom_up').animate({opacity: '1'}, 1200); } return false; }); $('.bottom_down i').click(function () { heights = heights + window.innerHeight; window.scrollTo(300, heights); $('.bottom_up').animate({opacity: '1'}, 1200); alert('Bottom_down ='+ heights); }); $(window).scroll(function() { if($(window).scrollTop() + window.innerHeight == $(document).height()) { $('.bottom_down').animate({opacity: '0'}, 1200); } });
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.