window.onload = function() { $(".calculate").height($(".china").height()); //滚动事件 function throttle(method, delay, duration) { var timer = null, begin = new date(); return function() { var context = this, args = arguments, current = new date(); cleartimeout(timer); if (current - begin >= duration) { method.apply(context, args); begin = current; } else { timer = settimeout(function() { method.apply(context, args); }, delay); } }; } $(window).scroll(function(){ throttle(onmousewheel(), 100, 100) }); // 获取reckon高度 function onmousewheel() { // var window_height = $(window).height(); // var reckon_height = $('.reckon').height(); var top = $(window).scrolltop(); var guntop = $(".guntop").offset().top; var endguntop = $(".endguntop").offset().top; // console.log(guntop) if (top > guntop) { $(".reckon").addclass("reckon_fixed_top"); if (top > endguntop - 500) { $(".reckon").removeclass("reckon_fixed_top"); $(".reckon").addclass("reckon_fixed_bottom"); $().css({ top: $(".at_lf").height() - $(".reckon").height() }); } else { $(".reckon").removeclass("reckon_fixed_bottom"); $(".reckon").addclass("reckon_fixed_top"); } } else { $(".reckon").removeclass("reckon_fixed_top"); } } };