代码地址:响应式时间轴.zip
如何实现滚动加载图片的?最主要是以下的代码部分:
(function() { $(document).ready(function() {var timelineAnimate; timelineAnimate = function(elem) { return $(".timeline.animated .timeline-row").each(function(i) {var bottom_of_object, bottom_of_window; bottom_of_object = $(this).position().top + $(this).outerHeight(); bottom_of_window = $(window).scrollTop() + $(window).height();if (bottom_of_window > bottom_of_object) { return $(this).addClass("active");} }); }; timelineAnimate();return $(window).scroll(function() { return timelineAnimate(); }); }); }).call(this);
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did72680