$(function () { //考試倒計(jì)時 function getTime() { var n = $('.banner_n').html(); var y = $('.banner_y').html(); var r = $('.banner_r').html(); var now = new Date(); var nowTime = now.getTime(); var end = new Date(n + "/" + y + "/" + r); var endTime = end.getTime(); var leftTime = endTime - nowTime; var d; if (leftTime >= 0) { d = Math.floor(leftTime / 1000 / 60 / 60 / 24) + 1; } else { d = 0; } $(".banner_fg_day").html(d); }; getTime(); setInterval(getTime, 1000); //錨點(diǎn)跳轉(zhuǎn)滑動效果 $('.time_listItem>a,.fixedRight__item>a').click(function () { if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { var $target = $(this.hash); $target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']'); if ($target.length) { var targetOffset = $target.offset().top; $('html,body').animate({ scrollTop: targetOffset }, 1000); return false; } } }); }) >