function ajaxlist(urls, data, fun) { $.ajax({ url: urls, type: 'POST', data: data, dataType: 'html', beforeSend: function (data) {}, success: fun, complete: function (data) {} }) } function videoClick(el) { var vidcontainer = $(".vidcontainer"), video = $(".vidcontainer video"), videoWrap = $('.vidcontainer iframe'); el.delegate(".li", "click", function (ev) { ev.stopPropagation ev.preventDefault var _this = $(this); var vid = _this.data("src"); var link = _this.data('link'); // ev.preventDefault(); if (link) { videoWrap.attr('src', link); vidcontainer.fadeIn(); videoWrap.stop().show(); video.stop().hide(); return; } else if (vid) { video.attr("src", vid); vidcontainer.fadeIn(); video.get(0).play(); videoWrap.stop().hide(); video.stop().show(); } }) $(".vidcontainer .closevid,.vidcontainer .mask").on("click", function (ev) { ev.stopPropagation(); if (!$(ev.target).hasClass("video")) { video.get(0).pause(); vidcontainer.fadeOut(function () { video.attr("src", ""); videoWrap.attr('src', ''); videoWrap.stop().show(); video.stop().show(); }) } }) } function scrollAnimation(ele) { $(ele).each(function () { var _this = $(this); if (_this.offset().top + 500 > $(window).scrollTop() + $(window).height() || _this.offset().top < $(window).scrollTop() - _this.outerHeight()) {} else if ($(window).scrollTop() >= _this.offset().top - $(window).height() * 0.92) { _this.addClass('animate'); } }); $(window).scroll(function () { $(ele).each(function () { var _this = $(this); if (_this.offset().top > $(window).scrollTop() + $(window).height() || _this.offset().top < $(window).scrollTop() - _this.outerHeight()) {} else if ($(window).scrollTop() >= _this.offset().top - $(window).height() * 0.92) { _this.addClass('animate'); } }); }); } function videoClick(el) { var vidcontainer = $(".vidcontainer"), video = $(".vidcontainer video"), videoWrap = $('.vidcontainer iframe'); el.delegate(".play-btn", "click", function (ev) { var _this = $(this); var vid = _this.data("src"); var link = _this.data('link'); ev.preventDefault(); if (link) { videoWrap.attr('src', link); vidcontainer.fadeIn(); videoWrap.stop().show(); video.stop().hide(); return; } else if (vid) { video.attr("src", vid); vidcontainer.fadeIn(); video.get(0).play(); videoWrap.stop().hide(); video.stop().show(); } }) $(".vidcontainer .closevid,.vidcontainer .mask").on("click", function (ev) { ev.stopPropagation(); if (!$(ev.target).hasClass("video")) { video.get(0).pause(); vidcontainer.fadeOut(function () { video.attr("src", ""); videoWrap.attr('src', ''); videoWrap.stop().show(); video.stop().show(); }) } }) } function scrollno() { $(window).scroll(function () { var before = $(window).scrollTop(); $(window).scroll(function () { var after = $(window).scrollTop(); if (before < after && window.innerWidth > 1024 && before > 0) { $('header').addClass('headroom-unpinned'); before = after; if (after > 20) { $('.pc-header').addClass('down'); } else { $('.pc-header').removeClass('down'); } }; if (before > after && window.innerWidth > 1024) { if (after > 20) { $('.pc-header').addClass('down'); } else { $('.pc-header').removeClass('down'); } $('.pc-header').removeClass('headroom-unpinned'); before = after; }; }) }) } function changeHeader() { $(window).scroll(function () { var top = $(window).scrollTop(); if (top > 0) { $('.pc-header').addClass('white'); } else { $('.pc-header').removeClass('white'); } }) } function backtop() { var $backtop = $('.totop'); var timer = null; $backtop.hover(function() { $(this).addClass('on') }, function() { $(this).removeClass('on') }); var scrolltop = $(this).scrollTop(); $(window).scroll(function() { scrolltop = $(this).scrollTop(); if ($(window).scrollTop() > 900) { $(".xf ").addClass("on") } else { $(".xf ").removeClass('on') } }) $backtop.click(function() { timer = setInterval(function() { var MoveTop = Math.floor(scrolltop / 10); $(window).scrollTop(scrolltop - MoveTop); if (MoveTop <= 0) { clearInterval(timer); } }, 10); }) $(document).on('mousewheel', function() { clearInterval(timer); }); } if ($(window).width() < 996) { $(" footer .nav .li ").click(function() { $(this).find(".sub").slideDown() $(this).siblings().find(".sub").slideUp() }) } backtop(); // $("body").on("click",".pdf",function () { // console.log(1) // var file = "?file=" + $(this).attr("data-file") // var url = "../../bocweb/pdf/web/viewer.html"; // url = url + file // console.log(url) // openPdf(url) // }) // function openPdf(url) { // window.open(url) // } function getnav(item) { var oNav = $('.aboutadd'); //鐎佃壈鍩呮竟锟 var aNav = oNav.find('.list a'); //鐎佃壈鍩 var aDiv = item; //濡ょ厧鐪 aNav.eq(0).addClass('on').siblings().removeClass("on"); $(window).scroll(function () { //閸欘垵顫嬬粣妤€褰涙妯哄 var winH = $(window).height(); //姒х姵鐖e姘З閻ㄥ嫯绐涚粋锟 var iTop = $(window).scrollTop(); // //姒х姵鐖e鎴濆З閺嶅嘲绱¢弨鐟板綁 aDiv.each(function () { if (winH + iTop - $(this).offset().top > winH / 5) { var _this = $(this).index(); // console.log(_this) aNav.removeClass('on'); aNav.eq(_this).addClass('on'); } }) if (iTop < 5) { aNav.eq(0).addClass('on').siblings().removeClass("on"); } }) aNav.on("click", function () { var index = $(this).index(); var top = aDiv.eq(index).offset().top - 70; $(this).addClass("on").siblings().removeClass("on"); $("body,html").animate({ scrollTop: top }, 1000); }) }