$(document).ready(function () { // 棣栭〉澶撮儴鎮诞鍥哄畾 if (window.location.pathname == '/') { var header = $("#header").offset().top; $(window).scroll(function () { var top = $(window).scrollTop(); if (top >= header) { $("#header").addClass("header_fixed"); } else { $("#header").removeClass("header_fixed"); } }); } $('.header').mouseenter(function (e) { $(this).addClass("over"); }); $('.header').mouseleave(function (e) { $(this).removeClass("over"); $('.nav_cont.on').removeClass('on'); $('.header .nav_list li.on').removeClass('on'); }); // 澶撮儴--nav 鏁堟灉 $('.header .nav_list li').mouseenter(function (e) { $(this).addClass("on").siblings().removeClass('on'); var index = $(this).index(); if ($(this).hasClass('no-expands')) { $('.nav_content .nav_cont').removeClass('on'); return; } $('.nav_content .nav_cont').removeClass('on'); $('.nav_content .nav_cont').eq(index).addClass('on'); }); // banner 杞挱鍥 bannerSlider(); // 鏂伴椈璧勮--杞挱鍥 newsSlider(); // 鏂伴椈璧勮--tab鍒囨崲 $(".news_tab li").click(function () { $(this).addClass('on').siblings().removeClass('on'); var index = $(this).index(); var content = '.news_con_con'; switch (index) { case 0: $(content).hide(); $(content + '01').show(); break; case 1: $(content).hide(); $(content + '02').show(); break; default: break; } }); // 鏂伴椈璧勮--鏂伴椈鍒掕繃鏁堟灉 var $newTanLi = $(".news_tab_list li"); $newTanLi.eq(0).addClass("active"); $newTanLi.eq(6).addClass("active"); if ($newTanLi.eq(0).hasClass("active")) { $newTanLi.eq(0).css("border-top", "0"); } if ($newTanLi.eq(6).hasClass("active")) { $newTanLi.eq(6).css("border-top", "0"); } $newTanLi.hover(function () { $(this).addClass("active").siblings().removeClass("active"); }); $(".list_con a").each(function () { var maxwidth = 80; if ($(this).text().length > maxwidth) { $(this).text($(this).text().substring(0, maxwidth)); $(this).html($(this).html() + '鈥?); } }); // 澶ф梾娓哥敓鎬 heartSlider(); //鐢ㄥ績闄潃浣 $(".ly_list01 li").eq(3).addClass("mar0"); $(".ly_list02 li").eq(2).addClass("mar0"); // 鏁板瓧涓潚鏃 $(".num_zqv_list li").eq(2).addClass("mar0"); $(".num_zqv_list li").eq(5).addClass("mar0"); // 鍏充簬鎴戜滑--鐐瑰嚮杩斿洖椤堕儴 goToTop(); $(window).scroll(function () { fixedGoToTopPos(); }); // 鍏充簬鎴戜滑--鑽h獕濂栭」 us_ryjx_tab(); $(".us_ryjx_tab_ul .us_ryjx_tab_li").click(function () { var index = $(this).index(); $(this).addClass("active").siblings().removeClass("active"); $(".us_ryjx_box .us_ryjx_list").eq(index).addClass("show").siblings().removeClass("show"); }); // 鏂伴椈璧勮--鏂伴椈鎶ラ亾 $('.news_search_box').click(function (event) { event.stopPropagation(); //$(this).addClass("on"); }); $(document).click(function (e) { if ($("#search").val() == "") { $('.news_search_box').removeClass("on"); $(".news_search_text").val(""); } }); $(".dtbd_tab li").click(function () { var index = $(this).index(); $(this).addClass('active').siblings().removeClass('active'); $(".dtbd_box .dtbd_list").eq(index).addClass("show").siblings().removeClass("show"); }); // 鏂伴椈璧勮--鏂伴椈鎶ラ亾--鍒楄〃鏁版嵁 getDataPro("news01", 1, 8, "", ""); getDataDq("dqjs_list_box", 1, 8) getDatacsr("shzr_list_box", 1, 6) getDatair("xxpl_list_box", 1, 8, "") getDatahr("recruit_list", 1, 8, "") // 鏂伴椈璧勮--鍥剧墖搴 $(".photos_tab li").click(function () { var index = $(this).index(); $(this).addClass('active').siblings().removeClass('active'); $(".photos_box .photos_list").eq(index).addClass("show").siblings().removeClass("show"); }); $(".photos_list_box .photos_list_li").click(function () { $("#alterDiv").empty(); $("#alterDivT").empty(); $("#alterDiv").attr("style", ""); $("#alterDivT").attr("style", ""); var divhtml = ""; var divt = ""; var info = JSON.parse($(this).attr("data-con")); $.each(info, function (e, ele) { if (e == "PvView") { $.each(ele, function (i, div) { divhtml += "
"; if (divt == "") { divt = "

" + div.Title + "

/
"; divt += "
" + div.Summary + "
"; } }); } }); $("#alterDiv").html(divhtml); $("#alterDivT").html(divt); $(".photos_pop").show(); photosSlider(); }); $(".photos_close_btn").click(function () { $(".photos_pop").hide(); }); // 鏂伴椈璧勮--瑙嗛褰卞儚 $(".video_tab li").click(function () { var index = $(this).index(); $(this).addClass('active').siblings().removeClass('active'); $(".video_box .video_list").eq(index).addClass("show").siblings().removeClass("show"); }); $(".video_list_box .video_list_li").click(function () { $("#alterDiv").empty(); var s = ""; var info = JSON.parse($(this).attr("data-con")); $.each(info, function (e, ele) { if (e == "PvView") { $.each(ele, function (i, div) { s += "
"; s += ""; s += "
"; s += "
"+div.Title+"
"; s += "
鍙戝竷鏃堕棿锛? + div.CreateTime + "
"; s += "
"; s += "
"; }); } }); $("#alterDiv").html(s); $(".videos_pop").show(); videoSlider(); }); $(".video_close_btn").click(function () { $(".videos_pop").hide(); }); // 澶ф梾娓哥敓鎬佽疆鎾 if (window.location.pathname == "/tourismeco/" || window.location.pathname == "/tourismeco/scenicspot/") { lystSlider1("ts1"); lystSlider1("ts0"); } else { lystSlider(); } if (window.location.pathname == "/ir/periodicreport/") { $(".irm_tit_box li a").eq(1).click() } // 绀句細璐d换 shzrSlider(); // 鎶曡祫鑰呭叧绯?-tab鍒囨崲 $(".irm_tab li").click(function () { var index = $(this).index(); $(this).addClass('active').siblings().removeClass('active'); }); // 閿氱偣婊戝姩 $("a[href*='#'],area[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; } } }); $(".news_search_btn").click(function () { var txt = $("#search").val() if (txt == "") { $(".news_search_box").addClass("on") } else { $("#nojieguo").hide(); var str = $(".news_tit_box li").eq(0).hasClass("active") ? "news01" : "news02"; var guid = $(".news_tit_box li").eq(0).hasClass("active") ? $(".news_tit_box li").eq(0).attr("data-rel") : $(".news_tit_box li").eq(1).attr("data-rel"); getDataPro(str, 1, 8, guid, $("#search").val()); } }); }); function bannerSlider() { var index = 1, len = $('.mobile-pic li').length, timer, str = ''; for (var i = 1; i <= len; i++) { if (i === 1) { str += ''; } else { str += '
  • '; } } $('.navlist').append(str); for (var i = 0; i < len; i++) { $('.mobile-pic li').eq(i).css({ 'z-index': len - i }); $('.banner-list li').eq(i).css({ 'z-index': len - i }); } $('.mobile').hover(function () { clearInterval(timer); }, function () { timer = setInterval(function () { play(index + 1); }, 5000); }).mouseleave(); $('.navlist li').hover(function () { play($(this).index() + 1); }); function play(num) { if (!$('.mobile-pic').is(':animated')) { if (num > len) { num = 1; } else if (num <= 0) { num = len; } index = num; $('.mobile-pic li').eq(index - 1).show().siblings().hide(); $('.banner-list li').eq(index - 1).show().siblings().hide(); $('.navlist li').eq(index - 1).addClass('navactive').siblings().removeClass('navactive'); } } } function newsSlider() { var index = 1, len = $('.slider-con li').length, timer, str = '', text, href; for (var i = 1; i <= len; i++) { if (i === 1) { str += '
  • '; } else { str += '
  • '; } } $('.slider-list').append(str); for (var i = 0; i < len; i++) { $('.slider-con li').eq(i).css({ 'z-index': len - i }); } $('.slider').hover(function () { clearInterval(timer); }, function () { timer = setInterval(function () { play(index + 1); }, 3000); }).mouseleave(); $('.slider-list li').hover(function () { play($(this).index() + 1); }); function play(num) { if (!$('.slider').is(':animated')) { if (num > len) { num = 1; } else if (num <= 0) { num = len; } index = num; text = $(".slider-con li").eq(index - 1).attr("data-text"); href = $(".slider-con li").eq(index - 1).find("a").attr("href"); $('.slider-con li').eq(index - 1).show().siblings().hide(); $('.slider-list li').eq(index - 1).addClass('on').siblings().removeClass('on'); $(".slider-text a").html(text); $(".slider-text a").attr("title", text); $(".slider-text a").attr("href", href); } } } function heartSlider() { var curIndex = 0, listLen = $(".heart_list li").length, //鍥剧墖鎬绘暟 listWid = $(".heart_list li").outerWidth(true); //鍥剧墖瀹藉害 if (listLen === 4) { $(".btn_box").hide(); } else { $(".btn_box").show(); } $(".l_btn").click(function () { if ($(this).hasClass("l_btn_def")) { return false; } else { curIndex = (curIndex > 0) ? (--curIndex) : (listLen - 1); changeTo(curIndex); if (curIndex > 0) { $(".r_btn").removeClass("r_btn_def"); } else { $(".l_btn").addClass("l_btn_def"); $(".r_btn").removeClass("r_btn_def"); return false; } } }); $(".r_btn").click(function () { if ($(this).hasClass("r_btn_def")) { return false; } else { curIndex = (curIndex < listLen - 1) ? (++curIndex) : 0; changeTo(curIndex); if (curIndex < listLen - 4) { $(".l_btn").removeClass("l_btn_def"); } else { $(".r_btn").addClass("r_btn_def"); $(".l_btn").removeClass("l_btn_def"); return false; } } }); function changeTo(num) { var goLeft = num * listWid; $(".heart_list").animate({ left: "-" + goLeft + "px" }, 500); } } function goToTop() { $(".go_to_top").on("click", function () { $("body,html").animate({ scrollTop: 0 }, 500) }) } function fixedGoToTopPos() { var windowHeight = $(window).height(); var t = $(window).scrollTop() , e = $(".footer_box").offset().top , a = e - t - windowHeight; if (t > 600) { if ($(".go_to_top").fadeIn(), a < 0) { var o = t + windowHeight - e + 100; $(".go_to_top").css("bottom", o) } else $(".go_to_top").css("bottom", "100px"); } else $(".go_to_top").fadeOut() } // 鑽h獕濂栭」 function us_ryjx_tab() { var curIndex = 0, $tabul = $(".us_ryjx_tab_ul"), $tabLi = $(".us_ryjx_tab_ul .us_ryjx_tab_li"), $btnLeft = $(".us_ryjx_l_btn"), $btnRight = $(".us_ryjx_r_btn"), listLen = $tabLi.length, ulWid = $tabul.outerWidth(true), liWid = $tabLi.outerWidth(true); $(".us_ryjx_tab_wrap").width(ulWid); $(".us_ryjx_tab_ul .us_ryjx_tab_li:last-child").addClass("w170") if (listLen < 6) { $btnLeft.addClass("us_ryjx_l_btn_def"); $btnRight.addClass("us_ryjx_r_btn_def"); } $btnLeft.click(function () { if ($(this).hasClass("us_ryjx_l_btn_def")) { return false; } else { curIndex = (curIndex > 0) ? (--curIndex) : (listLen - 1); changeTo(curIndex); if (curIndex > 0) { $btnRight.removeClass("us_ryjx_r_btn_def"); } else { $btnLeft.addClass("us_ryjx_l_btn_def"); return false; } } }); $btnRight.click(function () { if ($(this).hasClass("us_ryjx_r_btn_def")) { return false; } else { curIndex = (curIndex < listLen - 1) ? (++curIndex) : 0; changeTo(curIndex); if (curIndex < listLen - 6) { $btnLeft.removeClass("us_ryjx_l_btn_def"); } else { $btnRight.addClass("us_ryjx_r_btn_def"); return false; } } }); function changeTo(num) { var goLeft; if (num < listLen - 6) { goLeft = num * (liWid); } else { goLeft = num * (liWid) + 50; } $(".us_ryjx_tab_ul").animate({left: "-" + goLeft + "px"}, 500); } } //鏂伴椈璧勮 function getDataPro(id, p, other, guid, tit) { var $id = $("#" + id); if ($("#search").length > 0) { tit = $("#search").val(); } if (guid == "") { guid = "b5eb5cb5-9e72-474b-93be-1ed628f83043"; } $.ajax({ type: "Post", url: "/news/dtbdList?Guid=" + guid + "&page=" + p + "&row=" + other + "&title=" + tit, dataType: "json", success: function (DataPro) { if (DataPro == null) { $("#frist").hide(); $("#nojieguo").show(); var hmtl = "鎶辨瓑锛屾殏鏃舵病鎵惧埌涓 鈥? + tit + "鈥楛/span>鍖归厤鐨勭粨鏋?; $("#nojieguo .text01").html(hmtl); } else { var hmtl = "鎼滅储鈥淈span style='color:#EE6906'>" + tit + "鈥濓紝鎵惧埌鐩稿叧鏂伴椈绾? + DataPro[0].DataID + "绡? $("#nojieguo").hide(); var pageSize = Math.ceil(DataPro[0].DataID / other); if (pageSize > 0) { if ($id.next().hasClass("page")) { $id.empty(); $.each(DataPro, function (i, obj) { var txt = obj.Summary if (txt.length > 80) { txt = txt.substring(0, 80) + "..."; } $id.append('
    ' + obj.Title + '

    ' + obj.Title + '

    ' + txt + '

    鍙戝竷鏃堕棿锛? + getFDate(obj.CreateTime) + '
    '); }); $id.children(".loading").remove(); if (tit != "") { var txt01 = id == "news01" ? "n1" : "n2"; $("#" + txt01).html(hmtl); $("#" + txt01).show(); } $("#frist").show(); } else { $id.after("
    "); $id.empty(); $.each(DataPro, function (i, obj) { var txt = obj.Summary if (txt.length > 80) { txt = txt.substring(0, 80) + "..."; } $id.append('
    ' + obj.Title + '

    ' + obj.Title + '

    ' + txt + '

    鍙戝竷鏃堕棿锛? + getFDate(obj.CreateTime) + '
    '); }); if (tit != "") { var txt01 = id == "news01" ? "n1" : "n2"; $("#" + txt01).html(hmtl); $("#" + txt01).show(); } $("#frist").show(); } kkpager.init({ //divID pagerid: id + "pages", //褰撳墠椤电爜 pno: p, //鎬婚〉鐮 total: pageSize, //鎬绘暟鎹潯鏁 totalRecords: DataPro[0].DataID, //閾炬帴鍓嶉儴 hrefFormer: "javascript:getDataPro(\'" + id + "\'", hrefLatter: "," + other + ",'" + guid + "','" + tit + "');" }); kkpager.generPageHtml(); //if (guid == "00000000-0000-0000-0000-000000000000") { // var hmtl = "鎼滅储鈥淈span style='color:#EE6906'>" + tit + "鈥濓紝鎵惧埌鐩稿叧鏂伴椈绾? + DataPro[0].DataID + "绡?; // $("#searchresultDiv .text01").html(hmtl); // $("#searchresultDiv").show() //} } } }, error: function () { console.log("鏂伴椈璧勮鎺ュ彛鎶ラ敊"); } }); } function getDataDq(id, p, other) { var guid = $("#dqjs").val(); var $id = $("." + id); if (guid != undefined) { $.ajax({ type: "Post", url: "/cpc/dtbdList?Guid=" + guid + "&page=" + p + "&row=" + other, dataType: "json", success: function (DataPro) { if (DataPro == null) { alert("鏆傛棤鏁版嵁") } else { var pageSize = Math.ceil(DataPro[0].DataID / other); if (pageSize > 0) { if ($id.next().hasClass("page")) { $id.empty(); $id.html(""); $id.empty(); $.each(DataPro, function (i, obj) { $id.append('

    ' + obj.Title + '

    ' + obj.Summary + '

    鍙戝竷鏃堕棿锛? + getFDate(obj.CreateTime) + '
    ') }); $id.children(".loading").remove(); } else { $id.after("
    "); $id.empty(); $.each(DataPro, function (i, obj) { $id.append('

    ' + obj.Title + '

    ' + obj.Summary + '

    鍙戝竷鏃堕棿锛? + getFDate(obj.CreateTime) + '
    ') }); } kkpager.init({ //divID pagerid: id + "pages", //褰撳墠椤电爜 pno: p, //鎬婚〉鐮 total: pageSize, //鎬绘暟鎹潯鏁 totalRecords: DataPro[0].DataID, //閾炬帴鍓嶉儴 hrefFormer: "javascript:getDataDq(\'" + id + "\'", hrefLatter: "," + other + ");" }); kkpager.generPageHtml(); } } }, error: function () { console.log("鍏氱兢寤鸿鎺ュ彛鎶ラ敊"); } }); } } function getDatacsr(id, p, other) { var guid = "7b204d62-bccd-476d-b2c6-8261d1e1f262"; var $id = $("." + id); $.ajax({ type: "Post", url: "/csr/dtbdList?Guid=" + guid + "&page=" + p + "&row=" + other, dataType: "json", success: function (DataPro) { if (DataPro == null) { alert("鏆傛棤鏁版嵁") } else { var pageSize = Math.ceil(DataPro[0].DataID / other); if (pageSize > 0) { if ($id.next().hasClass("page")) { $id.empty(); $id.html(""); $id.empty(); $.each(DataPro, function (i, obj) { $id.append("

    " + obj.Title + "

    " + obj.Summary + "

    鍙戝竷鏃堕棿锛? + getFDate(obj.CreateTime) + "
    "); }); $id.children(".loading").remove(); } else { $id.after("
    "); $id.empty(); $.each(DataPro, function (i, obj) { $id.append("

    " + obj.Title + "

    " + obj.Summary + "

    鍙戝竷鏃堕棿锛? + getFDate(obj.CreateTime) + "
    "); }); } kkpager.init({ //divID pagerid: id + "pages", //褰撳墠椤电爜 pno: p, //鎬婚〉鐮 total: pageSize, //鎬绘暟鎹潯鏁 totalRecords: DataPro[0].DataID, //閾炬帴鍓嶉儴 hrefFormer: "javascript:getDatacsr(\'" + id + "\'", hrefLatter: "," + other + ");" }); kkpager.generPageHtml(); } } }, error: function () { console.log("绀句細璐d换鎺ュ彛鎶ラ敊"); } }); } function getDatair(id, p, other, guid) { var $id = $("." + id); if (guid == "") { guid = $("#dqbg").val(); } if (guid != undefined) { $.ajax({ type: "Post", url: "/ir/dtbdList?Guid=" + guid + "&page=" + p + "&row=" + other, dataType: "json", success: function (DataPro) { if (DataPro == null) { alert("鏆傛棤鏁版嵁") } else { $id.empty(); var pageSize = Math.ceil(DataPro[0].DataID / other); if (pageSize > 0) { if ($id.next().hasClass("page")) { $id.empty(); $id.html(""); $id.empty(); $.each(DataPro, function (i, obj) { $id.append("

    " + obj.Title + "

    鍙戝竷鏃堕棿锛? + getFDate(obj.CreateTime) + "
    涓嬭浇
    "); }); $id.children(".loading").remove(); } else { $id.after("
    "); $id.empty(); $.each(DataPro, function (i, obj) { $id.append("

    " + obj.Title + "

    鍙戝竷鏃堕棿锛? + getFDate(obj.CreateTime) + "
    涓嬭浇
    "); }); } kkpager.init({ //divID pagerid: id + "pages", //褰撳墠椤电爜 pno: p, //鎬婚〉鐮 total: pageSize, //鎬绘暟鎹潯鏁 totalRecords: DataPro[0].DataID, //閾炬帴鍓嶉儴 hrefFormer: "javascript:getDatair(\'" + id + "\'", hrefLatter: "," + other + ",'" + guid + "');" }); kkpager.generPageHtml(); } } }, error: function () { console.log("鎶曡祫鎺ュ彛鎶ラ敊"); } }); } } function getDatahr(id, p, other, guid) { var $id = $("." + id); var nName = $("#TypeName").val(); if (guid == "") { guid = $("#hr_dqbg").val(); } if (guid != undefined && nName != "" && nName != undefined) { $.ajax({ type: "Post", url: "/hr/dtbdList?Guid=" + guid + "&page=" + p + "&row=" + other, dataType: "json", success: function (DataPro) { if (DataPro == null) { alert("鏆傛棤鏁版嵁") } else { $id.empty(); var pageSize = Math.ceil(DataPro[0].DataID / other); if (pageSize > 0) { if ($id.next().hasClass("page")) { $id.empty(); $id.html(""); $id.empty(); $.each(DataPro, function (i, obj) { $id.append("

    " + obj.Title + "

    鍙戝竷鏃堕棿锛? + getFDate(obj.CreateTime) + "
    "); }); $id.children(".loading").remove(); } else { $id.after("
    "); $id.empty(); $.each(DataPro, function (i, obj) { $id.append("

    " + obj.Title + "

    鍙戝竷鏃堕棿锛? + getFDate(obj.CreateTime) + "
    "); }); } kkpager.init({ //divID pagerid: id + "pages", //褰撳墠椤电爜 pno: p, //鎬婚〉鐮 total: pageSize, //鎬绘暟鎹潯鏁 totalRecords: DataPro[0].DataID, //閾炬帴鍓嶉儴 hrefFormer: "javascript:getDatahr(\'" + id + "\'", hrefLatter: "," + other + ",'" + guid + "');" }); kkpager.generPageHtml(); } } }, error: function () { console.log("浜烘墠鎺ュ彛鎶ラ敊"); } }); } } function getDatairNew(id, p, other, guid, tit) { var $id = $("#" + id); $.ajax({ type: "Post", url: "/news/dtbdList?Guid=" + guid + "&page=" + p + "&row=" + other + "&title=" + tit, dataType: "json", success: function (DataPro) { $id.empty(); if (DataPro != null) { var pageSize = Math.ceil(DataPro[0].DataID / other); if (pageSize > 0) { if ($id.next().hasClass("page")) { $id.empty(); $.each(DataPro, function (i, obj) { var txt = obj.Summary if (txt.length > 80) { txt = txt.substring(0, 80) + "..."; } $id.append('
    ' + obj.Title + '

    ' + obj.Title + '

    ' + txt + '

    鍙戝竷鏃堕棿锛? + getFDate(obj.CreateTime) + '
    '); }); $id.children(".loading").remove(); } else { $id.after("
    "); $id.empty(); $.each(DataPro, function (i, obj) { var txt = obj.Summary if (txt.length > 80) { txt = txt.substring(0, 80) + "..."; } $id.append('
    ' + obj.Title + '

    ' + obj.Title + '

    ' + txt + '

    鍙戝竷鏃堕棿锛? + getFDate(obj.CreateTime) + '
    '); }); } kkpager.init({ //divID pagerid: id + "pages", //褰撳墠椤电爜 pno: p, //鎬婚〉鐮 total: pageSize, //鎬绘暟鎹潯鏁 totalRecords: DataPro[0].DataID, //閾炬帴鍓嶉儴 hrefFormer: "javascript:getDatairNew(\'" + id + "\'", hrefLatter: "," + other + ",'" + guid + "','" + tit + "');" }); kkpager.generPageHtml(); } } }, error: function () { console.log("鏂伴椈璧勮鎺ュ彛鎶ラ敊"); } }); } function getFDate(date) { var d = eval('new ' + date.substr(1, date.length - 2)); var ar_date = [d.getFullYear(), d.getMonth() + 1, d.getDate()]; for (var i = 0; i < ar_date.length; i++) ar_date[i] = dFormat(ar_date[i]); return ar_date.join('-'); } function dFormat(i) { return i < 10 ? "0" + i.toString() : i; } // 鏂伴椈璧勮--鍒嗛〉 var kkpager = { //divID pagerid: 'div_pager', //褰撳墠椤电爜 pno: 1, //鎬婚〉鐮 total: 1, //鎬绘暟鎹潯鏁 totalRecords: 0, //鏄惁鏄剧ず鎬婚〉鏁 isShowTotalPage: false, //鏄惁鏄剧ず鎬昏褰曟暟 isShowTotalRecords: false, //鏄惁鏄剧ず椤电爜璺宠浆杈撳叆妗 isGoPage: false, //閾炬帴鍓嶉儴 hrefFormer: '', //閾炬帴灏鹃儴 hrefLatter: '', /****閾炬帴绠楁硶****/ getLink: function (n) { //杩欓噷鐨勭畻娉曢€傜敤浜庢瘮濡傦細 //hrefFormer=http://www.xx.com/news/20131212 //hrefLatter=.html //閭d箞棣栭〉锛堢1椤碉級灏辨槸http://www.xx.com/news/20131212.html //绗?椤靛氨鏄痟ttp://www.xx.com/news/20131212_2.html //绗琻椤靛氨鏄痟ttp://www.xx.com/news/20131212_n.html if (n == 0) { return this.hrefFormer + this.hrefLatter; } else { return this.hrefFormer + ',' + n + this.hrefLatter; } }, //璺宠浆妗嗗緱鍒拌緭鍏ョ劍鐐规椂 focus_gopage: function () { var btnGo = $('#btn_go'); $('#btn_go_input').attr('hideFocus', true); btnGo.show(); btnGo.css('left', '0px'); $('#go_page_wrap').css('border-color', '#6694E3'); btnGo.animate({ left: '+=44' }, 50, function () { //$('#go_page_wrap').css('width','88px'); }); }, //璺宠浆妗嗗け鍘昏緭鍏ョ劍鐐规椂 blur_gopage: function () { setTimeout(function () { var btnGo = $('#btn_go'); //$('#go_page_wrap').css('width','44px'); btnGo.animate({ left: '-=44' }, 100, function () { $('#btn_go').css('left', '0px'); $('#btn_go').hide(); $('#go_page_wrap').css('border-color', '#DFDFDF'); }); }, 400); }, //璺宠浆妗嗛〉闈㈣烦杞 gopage: function () { var str_page = $("#btn_go_input").val(); if (isNaN(str_page)) { $("#btn_go_input").val(this.next); return; } var n = parseInt(str_page); if (n < 1 || n > this.total) { $("#btn_go_input").val(this.next); return; } //杩欓噷鍙互鎸夐渶鏀箇indow.open window.location = this.getLink(n); }, //鍒嗛〉鎸夐挳鎺т欢鍒濆鍖 init: function (config) { //璧嬪€ this.pno = isNaN(config.pno) ? 1 : parseInt(config.pno); this.total = isNaN(config.total) ? 1 : parseInt(config.total); this.totalRecords = isNaN(config.totalRecords) ? 0 : parseInt(config.totalRecords); if (config.pagerid) { this.pagerid = config.pagerid; } if (config.isShowTotalPage != undefined) { this.isShowTotalPage = config.isShowTotalPage; } if (config.isShowTotalRecords != undefined) { this.isShowTotalRecords = config.isShowTotalRecords; } if (config.isGoPage != undefined) { this.isGoPage = config.isGoPage; } this.hrefFormer = config.hrefFormer || ''; this.hrefLatter = config.hrefLatter || ''; if (config.getLink && typeof (config.getLink) == 'function') { this.getLink = config.getLink; } //楠岃瘉 if (this.pno < 1) this.pno = 1; this.total = (this.total <= 1) ? 1 : this.total; if (this.pno > this.total) this.pno = this.total; this.prv = (this.pno <= 2) ? 1 : (this.pno - 1); this.next = (this.pno >= this.total - 1) ? this.total : (this.pno + 1); this.hasPrv = (this.pno > 1); this.hasNext = (this.pno < this.total); this.inited = true; }, //鐢熸垚鍒嗛〉鎺т欢Html generPageHtml: function () { if (!this.inited) { return; } var str_prv = '', str_next = ''; if (this.hasPrv) { str_prv = '
  • 涓婁竴椤袋/span>
  • '; } if (this.hasNext) { str_next = '
  • 涓嬩竴椤袋/span>
  • '; } var str = ''; var dot = '
  • ...
  • '; var total_info = ''; if (this.isShowTotalPage || this.isShowTotalRecords) { total_info = '鍏?; if (this.isShowTotalPage) { total_info += this.total + '椤?; if (this.isShowTotalRecords) { total_info += ' / '; } } if (this.isShowTotalRecords) { total_info += this.totalRecords + '鏉′骇鍝?; } total_info += ''; } var gopage_info = ''; if (this.isGoPage) { gopage_info = ' 杞埌' + '' + '椤?; } //鍒嗛〉澶勭悊 if (this.total <= 8) { for (var i = 1; i <= this.total; i++) { if (this.total == 1) { } else if (this.pno == i) { str += '
  • ' + i + '
  • '; } else { str += '
  • ' + i + '
  • '; } else { str += '
  • ' + i + '
  • '; } else { str += '
  • 1) ? (--curIndex) : (listLen - 1); changeTo(curIndex); if (curIndex > 1) { $photosBtnRight.removeClass("r_btn_photos_def"); } else { $photosBtnLeft.addClass("l_btn_photos_def"); $photosBtnRight.removeClass("r_btn_photos_def"); return false; } } }); $photosBtnRight.click(function () { if ($(this).hasClass("r_btn_photos_def")) { return false; } else { curIndex = (curIndex < listLen) ? (++curIndex) : 0; changeTo(curIndex); if (curIndex < listLen) { $photosBtnLeft.removeClass("l_btn_photos_def"); } else { $photosBtnRight.addClass("r_btn_photos_def"); $photosBtnLeft.removeClass("l_btn_photos_def"); return false; } } }); } function changeTo(num) { var goLeft = (num - 1) * conWidth; setTimeout(function () { var imgTit = $(".photos_img img").eq(curIndex - 1).attr("alt"); var imgCon = $photosImg.eq(curIndex - 1).attr("data-con"); $photosBox.animate({left: "-" + goLeft + "px"}, 300); $(".photos_pop .cur").html(curIndex); $(".photos_pop .zong").html(listLen); $(".photos_img_tit h3").html(imgTit); $(".photos_img_jj").html(imgCon); }, 500); } } function videoSlider() { var winHeight = $(window).height(), //娴忚鍣ㄧ獥鍙i珮搴 conWidth = $(".video_con").width(), //瑙嗛瀹藉害 listLen = $(".video_con .video_list").length, //瑙嗛鎬绘暟 $videoBox = $(".video_box"), $videoBtn = $(".btn_video"), $videoBtnLeft = $(".l_btn_video"), $videoBtnRight = $(".r_btn_video"); // 鍒濆鍖 var curIndex = 1; $videoBtnLeft.unbind("click"); $videoBtnRight.unbind("click"); $videoBox.attr("style", ""); $videoBox.width((conWidth * listLen) + "px"); if (listLen === 1) { $videoBtn.hide(); } else { $videoBtn.show(); $videoBtnLeft.addClass("l_btn_video_def"); $videoBtn.removeClass("r_btn_video_def"); $videoBtnLeft.click(function () { if ($(this).hasClass("l_btn_video_def")) { return false; } else { curIndex = (curIndex > 1) ? (--curIndex) : (listLen - 1); changeTo(curIndex); if (curIndex > 1) { $videoBtnRight.removeClass("r_btn_video_def"); } else { $videoBtnLeft.addClass("l_btn_video_def"); $videoBtnRight.removeClass("r_btn_video_def"); return false; } } }); $videoBtnRight.click(function () { if ($(this).hasClass("r_btn_video_def")) { return false; } else { curIndex = (curIndex < listLen) ? (++curIndex) : 0; changeTo(curIndex); if (curIndex < listLen) { $videoBtnLeft.removeClass("l_btn_video_def"); } else { $videoBtnRight.addClass("r_btn_video_def"); $videoBtnLeft.removeClass("l_btn_video_def"); return false; } } }); } function changeTo(num) { var goLeft = (num - 1) * conWidth; setTimeout(function () { $videoBox.animate({left: "-" + goLeft + "px"}, 300); }, 500); } } function lystSlider() { var index = 1, len = $('.lyst_slider_con li').length, timer, str = ''; for (var i = 1; i <= len; i++) { if (i === 1) { str += '
  • '; } else { str += '
  • '; } } $('.lyst_slider_list').append(str); for (var i = 0; i < len; i++) { $('.lyst_slider_con li').eq(i).css({ 'z-index': len - i }); } $('.lyst_slider').hover(function () { clearInterval(timer); }, function () { timer = setInterval(function () { play(index + 1); }, 3000); }).mouseleave(); $(".lyst_slider_right").click(function () { play(index + 1); }).hover(function (e) { clearInterval(timer); }, function (e) { }); $(".lyst_slider_left").click(function () { play(index - 1); }).hover(function (e) { clearInterval(timer); }, function (e) { }); $('.lyst_slider_list li').hover(function () { play($(this).index() + 1); }); function play(num) { if (!$('.lyst_slider').is(':animated')) { if (num > len) { num = 1; } else if (num <= 0) { num = len; } index = num; $('.lyst_slider_con li').eq(index - 1).show().siblings().hide(); $('.lyst_slider_list li').eq(index - 1).addClass('on').siblings().removeClass('on'); } } } function lystSlider1(id) { var index = 1, len = $('#' + id + ' .lyst_slider_con li').length, timer, str = ''; for (var i = 1; i <= len; i++) { if (i === 1) { str += '
  • '; } else { str += '
  • '; } } $('#' + id + ' .lyst_slider_list').append(str); for (var i = 0; i < len; i++) { $('#' + id + ' .lyst_slider_con li').eq(i).css({ 'z-index': len - i }); } $('#' + id).hover(function () { clearInterval(timer); }, function () { timer = setInterval(function () { play(index + 1); }, 3000); }).mouseleave(); $('#' + id + " .lyst_slider_right").click(function () { play(index + 1); }).hover(function (e) { clearInterval(timer); }, function (e) { }); $('#' + id + " .lyst_slider_left").click(function () { play(index - 1); }).hover(function (e) { clearInterval(timer); }, function (e) { }); $('#' + id + ' .lyst_slider_list li').hover(function () { play($(this).index() + 1); }); function play(num) { if (!$('#' + id).is(':animated')) { if (num > len) { num = 1; } else if (num <= 0) { num = len; } index = num; $('#' + id + ' .lyst_slider_con li').eq(index - 1).show().siblings().hide(); $('#' + id + ' .lyst_slider_list li').eq(index - 1).addClass('on').siblings().removeClass('on'); } } } function shzrSlider() { var curIndex = 0, listLen = $(".shzr_baogao_list li").length, //鍥剧墖鎬绘暟 listWid = $(".shzr_baogao_list li").outerWidth(true); //鍥剧墖瀹藉害 $(".shzr_baogao_box").width((listWid * listLen) + "px"); $(".shzr_baogao_l_btn").click(function () { if ($(this).hasClass("shzr_baogao_l_btn_def")) { return false; } else { curIndex = (curIndex > 0) ? (--curIndex) : (listLen - 1); changeTo(curIndex); if (curIndex > 0) { $(".shzr_baogao_r_btn").removeClass("shzr_baogao_r_btn_def"); } else { $(".shzr_baogao_l_btn").addClass("shzr_baogao_l_btn_def"); return false; } } }); $(".shzr_baogao_r_btn").click(function () { if ($(this).hasClass("shzr_baogao_r_btn_def")) { return false; } else { curIndex = (curIndex < listLen - 1) ? (++curIndex) : 0; changeTo(curIndex); if (curIndex < listLen - 4) { $(".shzr_baogao_l_btn").removeClass("shzr_baogao_l_btn_def"); } else { $(".shzr_baogao_r_btn").addClass("shzr_baogao_r_btn_def"); return false; } } }); function changeTo(num) { var goLeft = num * listWid; $(".shzr_baogao_list").animate({ left: "-" + goLeft + "px" }, 500); } }