(function () { var $window = $(window); eachMove(); // 鐩戝惉榧犳爣绉诲姩锛岃繘鍏ュ彲瑙嗚寖鍥村唴鐨勫厓绱犲紑濮嬪姩鐢 window.onscroll = function () { eachMove(); }; /** * 閬嶅巻鎵€鏈夐渶瑕佺Щ鍔ㄧ殑鑺傜偣 */ function eachMove () { $('.move-to-right.hide, .move-to-left.hide, .down-to-up.hide').each(function (index, item) { if ($window.height() + $window.scrollTop() > $(item).offset().top) { move($(item)); } }); } /** * 鍔ㄧ敾 */ function move ($dom) { $dom.removeClass('hide').animate({marginLeft: 0,marginTop: 0, opacity: 1}, 1000); } })();