1 $(function(){ 2 $(window).scroll(function(){ 3 var curr_element = $('当前元素class或id名') 4 var active_class = '显示动画效果的class或id' 5 var scroll_h = $(window).scrollTop()+$(window).height(); 6 var self_top = curr_element.offset().top; 7 var self_h = curr_element.height(); 8 if( (scroll_h > self_top + self_h/2) && ( $(window).scrollTop() < self_top + self_h/2) ){ 9 // 显示动画效果 10 curr_element.addClass(active_class); 11 }else{ 12 // 退出动画效果 13 curr_element.removeClass(active_class); 14 } 15 }) 16 })