$(document).ready(function(){ // 动画初始化 // $("header .pc-header .right-btn .search").click(function() { // if ($(this).hasClass("on")) { // $(this).removeClass("on") // $(".pc-header").removeClass("on"); // $(".pc_seachbox").slideUp(); // $("html,body").scrollTop(wtop) // $(".header_nav_bg").removeClass("on"); // } else { // $(this).addClass("on") // $(".pc-header").addClass("on"); // $(".pc_seachbox").slideDown(); // wtop = $(window).scrollTop() // $(".header_nav_bg").addClass("on"); // } // }) // $(window).scroll(function() { // $("header .pc-header .right-btn .search").removeClass("on") // $(".pc_seachbox").slideUp(); // var target_top = $(window).scrollTop(); // if (target_top > 35) { // $(".pc-header").addClass("on"); // }else{ // $(".pc-header").removeClass("on"); // } // }); // var target_top = $(window).scrollTop(); // if (target_top > 35) { // $(".pc-header").addClass("on"); // }else{ // $(".pc-header").removeClass("on"); // } }); 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(); }) } }) }