function isWx() { var ua = navigator.userAgent.toLowerCase(); if (ua.match(/MicroMessenger/i) == "micromessenger") { return true; } else { return false; } } function checkWxUrl(url) { if (isWx()) { var r = url.replace(/\./g, "\\\.").replace(/\?/g, "\\\?"); var reg = new RegExp(r + "$"); if (!reg.test(window.location.href)) { window.location.href = url; } } } $(function () { $('.menu-icon a').click(function () { if ($('.menu').hasClass('open')) { $('.menu').show().css('right', 0).removeClass('open'); $('.menu').animate({ 'right': -120 }, 200, function () { $('.menu').removeAttr('style'); }); } else { $('.menu').show().animate({ 'right': 0 }, 200, function () { $('.menu').addClass('open'); $('.menu').removeAttr('style'); }); } return false; }); $('.go-top').click(function () { $('html,body').animate({ 'scrollTop': 0 }, 500); return false; }); $("a[href='#']").click(function () { return false; }); $('.lmenu .larrow>span').click(function () { $(this).parent().toggleClass('open'); return false; }); $('.tab-item').click(function () { var tabs = $(this).parents('.tab'); var id = $(this).attr('data-id'); tabs.find(".tab-item[data-id!='" + id + "'].active").removeClass('active'); $(this).addClass('active'); tabs.find(".tab-content[data-id!='" + id + "']:visible").hide(); tabs.find(".tab-content[data-id='" + id + "']").show(); return false; }); $('.subtype-cover').click(function () { $(this).parents('.subtype-list').find('.subtype-item').removeClass('active'); $(this).parents('.subtype-item').addClass('active'); }); function changeCode(reset) { var img = $('.captcha'); var w = img.width(); var h = img.height(); var f = parseInt(h * 0.5); img.attr('src', "/inc/code.ashx?w=" + w + "&h=" + h + "&f=" + f + "&r=" + (new Date()).getTime() + (reset ? "&b=1" : "")); } if ($('.captcha').size() > 0) { $('.captcha,.captcha-link').click(function () { changeCode(true); return false; }); changeCode(true); } function initImg() { $("img[height],img[style]").removeAttr('height').css('height', 'auto'); } initImg(); function initImgFloat() { var classNames = ['img-2', 'img-3', 'img-4']; for (var i in classNames) { $('.' + classNames[i]).each(function () { var next = $(this).next(); if (next.hasClass(classNames[i])) return true; var style = next.attr('style'); if (!style || style == '' || style.indexOf('clear') == -1) { $('
').insertAfter($(this)); } }); } } initImgFloat(); function initFloat() { var links = $('.float-links'); //links.css('marginTop', '-' + ($('.float-links').height() / 2) + 'px'); var w = $(window).width(); var h = $(window).height(); if (w < 1600) { links.addClass('icon-only'); } else { links.removeClass('icon-only'); } if (w < 768 || h < 400) { links.hide(); } else { links.fadeIn(); } } $(window).resize(initFloat); initFloat(); });