$(function () { $("a").focus(function () { this.blur(); }); //搜索s $(".search .icon").click(function () { $(".searchbox").show(); $(".search .icon").addclass("on"); }); $(".search .i2").click(function () { $(".searchbox").hide(); $(".search .icon").removeclass("on"); }); //搜索end $(".openbtn").click(function () { $(this).toggleclass("on"); $(".mainnav").animate({ right: "0px" }); $(".mstbg").fadein(); $("body").addclass("bodyon"); $(".closebtn").fadein(1000); }); // $(".closebtn").click(function () { $(".openbtn").removeclass("on"); $(".mainnav").animate({ right: "-180px" }); $(".mstbg").fadeout(); $("body").removeclass("bodyon"); $(".closebtn").fadeout(0); }); // $('.newsright .slidebox').hide(); tab_fuc($(".newsnav li"), $(".newsright .slidebox"), 'on', 'click'); function tab_fuc(list, cont, cls, trig) { list.eq(2).addclass(cls); cont.eq(2).show(); trig = trig ? trig : 'click'; list.on(trig, function () { if (!$(this).hasclass(cls)) { list.removeclass(cls); $(this).addclass(cls); cont.stop(true, true).hide(); cont.eq($(this).index()).stop(true, true).fadein(400); } }); }; // // $(".singlepage img").removeattr("width").removeattr("height"); $(".singlepage img").parent("p span").css("text-indent", "0em"); $(".singlepage img").parent("p").css("text-indent", "0em"); // var offset = 300, offset_opacity = 1200, scroll_top_duration = 1000, $back_to_top = $('.cd-top'); $(window).scroll(function () { ($(this).scrolltop() > offset) ? $back_to_top.addclass('cd-is-visible') : $back_to_top.removeclass('cd-is-visible'); }); $back_to_top.on('click', function (event) { event.preventdefault(); $('body,html').animate({ scrolltop: 0 }, scroll_top_duration ); });//返回顶部 }); jquery(".pcnav li").bind("mouseover", function () { jquery(this).find(".navpull").stop(true, true).slidedown(); jquery(this).addclass("onnav"); jquery("body").addclass("bodyon2"); }) jquery(".pcnav li").bind("mouseleave", function () { jquery(this).find(".navpull").stop(true, true).slideup(); jquery(this).removeclass("onnav"); jquery("body").removeclass("bodyon2"); }) $(".mobilenav li").click(function () { $(this).toggleclass("onnav"); $(this).find(".navpull").slidetoggle(); }); //jquery start $(function () { $('a[href*=#]').click(function () { if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { var $target = $(this.hash); $target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']'); if ($target.length) { var targetoffset = $target.offset().top; $('html,body').animate({ scrolltop: targetoffset }, 1000); return false; } } }); }); //jquery end