$(function () { mar_pad(); pageModul(); }) /*mar_pad*/ function mar_pad() { for (i = 1; i < 101; i++) { $(".mt_" + i + "").css("marginTop", i + "px"); $(".mb_" + i + "").css("marginBottom", i + "px"); $(".ml_" + i + "").css("marginLeft", i + "px"); $(".mr_" + i + "").css("marginRight", i + "px"); $(".pt_" + i + "").css("paddingTop", i + "px"); $(".pb_" + i + "").css("paddingBottom", i + "px"); $(".pl_" + i + "").css("paddingLeft", i + "px"); $(".pr_" + i + "").css("paddingRight", i + "px"); if (i < 11) { $(".em_" + i * 5 + "").css("marginRight", i * 0.5 + "em") } } $(".em_05").css("marginRight", 0.5 + "em") } /*violin*/ (function ($) { $.fn.extend({ "violin": function (options) { if (!isValid(options)) return this; var opts = $.extend({}, defaluts, options); return this.each(function () { var $this = $(this); var n = $this.find("ul li").size(); $this.find("ul li").css({ "position": "absolute", "left": "0", "top": "0", "width": "100%", "text-align": "center" }) $this.find("ul li a img").css({"display": "block"}) if (n == 0) { return this } $this.find(".others p").html("") $this.find(".more:gt(0)").css("display", "none") for (i = 0; i < n; i++) { var $dot = $("") if (i == 0) { $dot = $("") } else { $this.find("ul li").eq(i).hide() $this.find(".others h1").eq(i).hide() } $this.find(".others p").append($dot) } var x = 0, timer = setInterval(loop, 5000) function loop() { x++; if (x > n - 1) (x = 0) move() } $this.hover(function () { clearInterval(timer) }, function () { clearInterval(timer); timer = setInterval(loop, 5000) }) $this.find(".others .rightBtn").click(function () { x++; if (x > n - 1) (x = 0); move() }) $this.find(".others .leftBtn").click(function () { x--; if (x < 0) (x = n - 1); move() }) $this.find(".others p i").each(function (i) { $(this).hover(function () { x = i; move() }, function () { x = i; }) }) function move() { if (!$this.find("ul li").is(":animated")) { $this.find("ul li").eq(x).fadeIn(600).siblings("li").fadeOut(600); $this.find(".others h1").eq(x).fadeIn(600).siblings("h1").fadeOut(600); $this.find(".others p i").eq(x).addClass("on").siblings("i").removeClass("on"); $this.find(".more").css("display", "none") $this.find(".more").eq(x).css("display", "block") } } }); } }); var defaluts = { foreground: 'red' }; function isValid(options) { return !options || (options && typeof options === "object") ? true : false; } })(window.jQuery); /*violinSlc*/ (function ($) { $.fn.extend({ "violinSlc": function (options) { if (!isValid(options)) return this; var opts = $.extend({}, defaluts, options); return this.each(function () { var $this = $(this); $this.find("" + opts.show + ":gt(0)").css("display", "none") $this.find(opts.btn).eq(0).addClass("on") $this.find(opts.btn).each(function (i) { $(this).click(function () { $this.find(opts.btn).removeClass("on") $(this).addClass("on") $this.find(opts.show).css("display", "none") $this.find(opts.show).eq(i).css("display", "block") }) }) }); } }); var defaluts = { btn: ".SlcBtn", show: ".SlcShow" }; function isValid(options) { return !options || (options && typeof options === "object") ? true : false; } })(window.jQuery); /*violinSlide*/ (function ($) { $.fn.extend({ "violinSlide": function (options) { if (!isValid(options)) return this; var opts = $.extend({}, defaluts, options); return this.each(function () { var $this = $(this), $item = $this.find(opts.item); if ($this.find(opts.item).size() == 0) { $item = $this; } return $item.each(function () { var $this_item = $(this), $item_btn = $this_item.find(opts.btn), $item_show = $this_item.find(opts.show); $item_show.hide(); if (opts.type == "hover") { var _btn = $this_item.find(opts.btn), _show = $this_item.find(opts.show); _btn.hover(function () { _show.stop().slideDown(300) }, function () { _show.stop().slideUp(300) }) _show.hover(function () { _show.stop().slideDown(300) }, function () { _show.stop().slideUp(300) }) } if (opts.type == "click") { $this_item.find(opts.btn).click(function () { if($this_item.find(opts.show).css("display")=="none"){ $this_item.find(opts.show).stop().slideDown(300); $this_item.siblings().find(opts.show).stop().slideUp(300); $this_item.find(opts.btn).addClass("on") $this_item.siblings().find(opts.btn).removeClass("on") }else { $this_item.find(opts.show).stop().slideUp(300); $this_item.find(opts.btn).removeClass("on") } }) } }) }); } }); var defaluts = { item: ".pullDown", btn: ".SlcBtn", show: ".SlcShow", type: "hover" }; function isValid(options) { return !options || (options && typeof options === "object") ? true : false; } })(window.jQuery); function pageModul() { search01(); subBox(); menu(); myNav(); show_article(); letterBox(); } $(window).resize(function (event) { myNav(); }); function search01() { $(".search01 input[type='image']").click(function (e) { e.preventDefault() $(this).prev().addClass("an") }) } function subBox() { $(".ul_list03 li").hover(function () { $(this).find(".subBox").stop().slideDown(300); }, function () { $(this).find(".subBox").stop().slideUp(300); }) } function show_article() { $(".show_article").click(function () { var max_height = $(this).parent().prev().css("max-height"); if (max_height == "10000px") { $(this).parent().prev().animate({"max-height": "250px"}, 300); } else { $(this).parent().prev().animate({"max-height": "10000px"}, 300); } }) } function menu() { $('.menuBtn').append(''); $('.menuBtn').click(function (event) { $(this).toggleClass('open'); var _winw = $(window).width(); var _winh = $(window).height(); if ($(this).hasClass('open')) { $('body').addClass('open'); if (_winw <= 1199) { $('.soBox').stop().slideDown(); $('#hd-m .inner').stop().slideDown(); } } else { $('body').removeClass('open'); if (_winw <= 1199) { $('.soBox').stop().slideUp(); $('#hd-m .inner').stop().slideUp(); } } }); $('#hd-m .nav-m .first-level').click(function () { $(this).parents().find(".subBox").stop().slideUp(); $(this).parent().siblings().find(".v1").removeClass('v1-open'); $(this).prev().toggleClass('v1-open'); $(this).parent().siblings().find(".v2").removeClass("open"); $(this).parent().siblings().find(".subBox2").hide(); $(this).next(".subBox").stop().slideToggle(); }); $('#hd-m .nav-m .subBox .second-level').click(function (e) { $(this).parent().siblings().find(".v2").removeClass("open"); $(this).parents().find(".subBox2").hide(); $(this).prev().toggleClass('open'); if ($(this).prev().hasClass('open')) { $(this).next().show(); } else { $(this).next().hide(); } ; }); $("#hd-m .so-Box .btn").click(function () { $(this).parents("#hd-m .so-Box").addClass('open'); }); $("#hd-m .so-Box .close").click(function () { $(this).parents("#hd-m .so-Box").removeClass('open'); }); $("#hd-m .inner .bg").click(function () { $(this).parents().find(".menuBtn").removeClass('open'); $(this).parent("#hd-m .inner").fadeOut(); }); } //公用手机导航 function myNav() { var _winw = $(window).width(); if (_winw > 1199) { $('body').removeClass('open'); } else { $("#hd-m .nav .subBox2").hide(); var navLength = $('#hd-m .nav > li').length; for (var i = 0; i < navLength; i++) { if ($("#hd-m .nav li").eq(i).children('.v1').siblings('.subBox').length) { $("#hd-m .nav li").eq(i).children('.v1').addClass('v1-ok'); } } ; var ddLength = $('#hd-m .nav .subBox dl dd').length; for (var i = 0; i < ddLength; i++) { if ($("#hd-m .nav .subBox dl dd").eq(i).children('.v2').siblings('.subBox2').length) { $("#hd-m .nav .subBox dl dd").eq(i).children('.v2').addClass('v2-ok'); } } ; } } function letterBox() { $(".letterBox ul li span").each(function () { $(this).click(function () { $(this).parent().addClass("on").siblings().removeClass("on") $(".letterBox .letterSlc").html($(this).html()) }) }) }