window.onload = function () { $('.header .nav>ul>li').hover(function () { $(this).find('ul').stop().slideToggle(); }); $("#back_top").click(function () { $("html,body").animate({ scrollTop: 0 }, 400); }); $('.activity_box li').each(function () { if ($(this).find('p').text().length < 28) { $(this).find('p').css({ 'line-height': '60px' }) } else { } }); $('.leftlist').height($('.subpage_content').height()); $('.tab_nav li').mouseenter(function () { if ($(this).is('.notice')) { $(this).addClass('active'); $('.activity').removeClass('active'); $('.activity_box').fadeOut(300); setTimeout(function () { $('.notice_box').fadeIn(); }, 300) } else { $(this).addClass('active'); $('.notice').removeClass('active'); $('.notice_box').fadeOut(300); setTimeout(function () { $('.activity_box').fadeIn(); }, 300) } }); var primemaxindex; var mySwiper = new Swiper('.swiper-container', { speed: 500, autoplay: 50000000, loop: true, grabCursor: true, paginationClickable: true, onFirstInit: function (swiper) { $('.swiper-wrapper>div').each(function () { primemaxindex = $(this).index(); }); }, onSlideNext: function (swiper) { var maxindex; $('.swiper-wrapper>div').each(function () { maxindex = $(this).index(); }); if ($('.swiper-slide-active').index() == maxindex - 1) { if (maxindex == primemaxindex + 1) { return false; } else { $('.swiper-wrapper').width((maxindex + 2) * 1400); var firsthtml = $('.swiper-slide').eq(2).html(); firsthtml = '
' + firsthtml + '
'; $('.swiper-wrapper').append(firsthtml); } } } }); $(".teacherslist>ul>li .fl").each(function () { $img = $(this).find("img"); console.log($w = $img.width()); $h = $img.height(); /* sr = $img.attr("src") alert(sr+","+$w+","+$h)*/ $bw = $(this).width(); $bh = $(this).height(); b1 = $w / $h; b2 = $bw / $bh; if (b1 > b2) { $img.css("height", "100%") $wed = $bh * b1; $img.css("width", $wed + "px") fz = ($(".teacherslist>ul>li .fl").width() - $wed) / 2; $img.css("margin-left", fz + "px") } else { $img.css("width", "100%") $hed = $bw / b1; $img.css("height", $hed + "px") fs = ($(".teacherslist>ul>li .fl").height() - $hed) / 2; $img.css("margin-top", fs + "px") } }); }