var width=$(window).width(); // 手机端导航代码开始 var forEach=function(t,o,r){if("[object Object]"===Object.prototype.toString.call(t))for(var c in t)Object.prototype.hasOwnProperty.call(t,c)&&o.call(r,t[c],c,t);else for(var e=0,l=t.length;l>e;e++)o.call(r,t[e],e,t)}; var hamburgers = document.querySelectorAll(".hamburger"); if (hamburgers.length > 0) { forEach(hamburgers, function(hamburger) { hamburger.addEventListener("click", function() { this.classList.toggle("is-active"); }, false); }); } var anniukai =true; $(".header4").click(function() { if(anniukai){ $(".headershouji").fadeIn(200); $('html,body').css("overflow","hidden"); anniukai = false; }else{ $(".headershouji").fadeOut(200); $('html,body').css("overflow", "auto"); anniukai = true; } }); // 手机端导航代码结束 // 付费内页点击复选框勾选计算代码开始 $(".fuwu2").click(function() { myFunction(); //改变支付价格 $('.zhifubao2-1 span').text(conts); $('.weixin2-1 span').text(conts); $('.jieshao2-4 em').text(conts); }); function myFunction() { conts = 0; pay_service_id=""; $(".gou").each(function() { if ($(this).attr("checked")) { conts = parseFloat(conts) + parseFloat($(this).val()); conts = conts.toFixed(2); pay_service_id = $(this).attr('id') + ',' + pay_service_id; } }); $(".zhanshi1-7 span i").html(conts); }; myFunction(); $('.zhifubao2-1 span').text(conts); $('.weixin2-1 span').text(conts); $('.jieshao2-4 em').text(conts); // 付费内页点击复选框勾选计算代码结束 // 导航三点点击特效开始 $(document).click(function() { $(".header3-2-1").removeClass("_1lCfv"); }) $(".header3-2").click(function(e) { remove_1lCfv(); $(".header3-2-1").addClass("_1lCfv"); e.stopPropagation(); //阻止冒泡 }) // 导航三点点击特效结束 // 导航登录头像点击特效开始 $(".header3-4-2").click(function(e) { remove_1lCfv(); $(".header3-4-2-1").addClass("_1lCfv"); e.stopPropagation(); //阻止冒泡 }) $(document).click(function() { $(".header3-4-2-1").removeClass("_1lCfv"); }) $(".header3-4-1").click(function(e) { remove_1lCfv(); $("this").addClass("dd"); e.stopPropagation(); //阻止冒泡 }) function remove_1lCfv() { $.each($('._1lCfv'), function(i, elem) { $(elem).removeClass('_1lCfv'); }) } // 导航登录头像点击特效结束 // 导航消息击特效开始 $(document).click(function() { $(".header3-4-1-1").removeClass("_1lCfv"); }) $(".header3-4-1").click(function(e) { remove_1lCfv(); $(".header3-4-1-1").addClass("_1lCfv"); e.stopPropagation(); //阻止冒泡 }) // 导航消息点击特效结束 // 底部微信悬停特效开始 $(".wxkai").hover(function() { $(".wx").addClass("wxhover"); }, function() { $(".wx").removeClass("wxhover"); }); // 底部微信悬停特效结束 // 收藏代码开始 $(document).ready(function () { $(".like-it").live('click',function () { var item = $(this).find('img'); var num = $(this).find('count'); var id = $(this).attr('templet_id'); var src = item.attr('src'); var icon_src = item.attr('data-src'); $.ajax({ url: 'http://pay/index/do_paytemplet_favorite', type: "POST", data: {id: id}, dataType: 'json', success: function (data) { if (data.result == 0) { if(item.hasClass('mf-liked')){ item.addClass('mf-like').removeClass('mf-liked'); item.attr("src", icon_src); item.attr("data-src", src); num.text(parseInt(num.text())-1); }else{ item.addClass('mf-liked').removeClass('mf-like'); item.attr("src", icon_src); item.attr("data-src", src); num.text(parseInt(num.text())+1); } } else { $('.mf_dengluzhezhao').fadeIn(300); $('.mf_denglu').removeClass('bounceOutUp').addClass('animated bounceInDown').fadeIn(); } } }); }); }); // 收藏代码结束 // 点赞代码开始 $(".case-like").click(function() { var item = $(this); var id = $(this).data('caseid'); var count = $(this).find('count'); $.ajax({ url: 'http://pay/index/do_case_favorite', type: "POST", data: {id: id}, dataType: 'json', success: function (data) { if (data.result == 0) { item.addClass('case-liked'); var num = parseInt(count.text()); num +=1; count.text(num); } } }) }); // 点赞代码结束 // 分页跳转获取焦点代码开始 $("#yematiao").focus(function() { $("#yematiao").css("color", "#27282d"); $("#fenye1-1-2").addClass("chang"); }); $("#yematiao").blur(function() { $("#fenye1-1-2").removeClass("chang"); }); // 分页跳转获取焦点代码结束 // 搜索框代码开始 if(width>1199){ $("#keyword").click(function() { $('html,body').animate({ 'scrollTop': 0 }, 200); $('html,body').css("overflow", "hidden"); $(".headerxuanzhe").addClass("xianshi"); }); } $(window).resize(function(){ var width=$(window).width(); // console.log(width); if(width>1199){ $("#keyword").click(function() { $('html,body').animate({ 'scrollTop': 0 }, 200); $('html,body').css("overflow", "hidden"); $(".headerxuanzhe").addClass("xianshi"); }); }else{ $("#keyword").unbind("click"); } }); $(".headerxuanzhe1-2").click(function() { $(".leibie").removeAttr('checked'); $(".headerxuanzhe1-2 .u-checkbox").removeClass("z-checked"); $(this).find(".u-checkbox").addClass("z-checked"); $(this).find(".leibie").attr('checked', 'checked'); }); $(".headerxuanzhe1").click(function() { $(".headerxuanzhe").addClass("xianshi"); return false; }); var href = location.href; if (href.indexOf('blog')!=-1) { $(".leibie").removeAttr('checked'); $('input[value="/blog"]').attr('checked', 'checked'); } $(".headerxuanzhe").click(function(){ $(this).removeClass("xianshi"); $('html,body').css("overflow", "auto"); }); $("#keyword").keydown(function(event){ event=document.all?window.event:event; if((event.keyCode || event.which)==13){ $('.search_type').each(function(){ if ($(this).attr('checked')=='checked') { search_type = $(this).val(); } }); var keywords=$('.search_form input').val(); if( keywords.trim()!=="" ){ location.href = "http://pay"+search_type+"/p/1/keyword/"+keywords; }else{ location.href = "http://pay"; } } }); // 搜索框代码结束 // 手机搜索分类选择代码开始 $(".shoujixuanzhe2-1").click(function() { $(".shoujileibie").removeAttr('checked'); $(".shoujixuanzhe2-1 .u-checkbox").removeClass("z-checked"); $(this).find(".u-checkbox").addClass("z-checked"); $(this).find(".shoujileibie").attr('checked', 'checked'); });// 手机搜索分类选择代码结束 // 返回顶部代码开始 $('.fanhui').on('click', function() { $('html,body').animate({ 'scrollTop': 0 }, 700); }); // 返回顶部代码结束 // 博客内页文章分类手机端导航滚动条代码开始 if(width < 992){ bokejisuan() } $(window).resize(function(){ bokejisuan() }); function bokejisuan(){ var width=$(window).width(); if(width < 992){ var daowidth = 0; $('.wenzhangfenlei2 li').each(function () { daowidth += $(this).outerWidth(true); }); $('.wenzhangfenlei2 ul').css('width', daowidth+1 + "px"); } } // 博客内页文章分类手机端导航滚动条代码结束 // 首页分类手机端滚动条代码开始 if(width < 640){ jisuan() } $(window).resize(function(){ var width=$(window).width(); if(width < 640){ jisuan() } }); function jisuan(){ var p=$('.shaixuanzong>.shaixuan1'); for( var i=0;i0){ if(oul.css('left')=='0px'){ oul.css('left',-ulWidth/2+'px'); } oul.css('left','+='+speed+'px'); } } timeId = setInterval(slider,30); $('.scroll-block-1').on({ 'mouseover': function(){ clearInterval(timeId); }, 'mouseout': function(){ timeId = setInterval(slider,30); } }) }); $(function(){ var oul = $('.scroll-block-2 ul'); var oulHtml = oul.html(); oul.html(oulHtml+oulHtml) var timeId = null; var ali = $('.scroll-block-2 ul li'); var aliWidth = ali.eq(0).width(); var aliSize = ali.size(); var ulWidth = aliWidth*aliSize; oul.width(ulWidth); var speed = -2; function slider(){ if(speed<0){ if(oul.css('left')==-ulWidth/2+'px'){ oul.css('left',0); } oul.css('left','+=-2px'); } if(speed>0){ if(oul.css('left')=='0px'){ oul.css('left',-ulWidth/2+'px'); } oul.css('left','+='+speed+'px'); } } timeId = setInterval(slider,30); $('.scroll-block-2').on({ 'mouseover': function(){ clearInterval(timeId); }, 'mouseout': function(){ timeId = setInterval(slider,30); } }) }); // 首页分类手机端滚动条代码结束