var language = getcookie("language"); $(document).ready(function () { $(".news-list2").css("display", "none"); $(".news .l-news-cont .r-news-txt .news-list ul li").mouseover(function () { $(this).siblings().removeclass("active"); $(this).addclass("active"); }); $(".news .l-news-cont .r-news-txt .tog span").click(function () { $(this).siblings().removeclass("act"); $(this).addclass("act"); $(".news-list").css("display", "none"); $(".l-news-img").css("display", "none"); $($(this).data("ref")).css("display", "block"); }); //滚动到了“中梁在中国”区域 document.addeventlistener('scroll', function () { // 滚动条高度+视窗高度 = 可见区域底部高度 var visiblebottom = window.scrolly + document.documentelement.clientheight; // 可见区域顶部高度 var visibletop = window.scrolly; var centery = $(".r-bd")[0].offsettop + $(".r-bd")[0].offsetheight / 2; if (centery > visibletop && centery < visiblebottom) circirexpand(); }) $(document).on("click", ".news_detail", function () { setcookie("detail_type", $(this).data("type"));// 1-集团新闻 2-媒体报道 3-社会责任-新闻报道 4-社会责任-媒体报道 setcookie("detail_id", $(this).data("id")); window.open("media-news-details.html?detail_id="+$(this).data("id")+"&detail_type="+$(this).data("type"), "_self"); }) // 查询轮播图 $.ajax({ type: 'get', url: './front/idx/drawing', datatype: 'json', async: true, data: { source : 1 }, success: function (data) { showdrawing(data); }, error: function (xmlhttprequest, textstatus, errorthrown) { console.error("查询轮播图信息失败!"); } }); // 查询新闻 $.ajax({ type: 'get', url: './front/media/group_news/getidxnews', datatype: 'json', async: true, data: { language: language }, success: function (data) { shownews(data); }, error: function (xmlhttprequest, textstatus, errorthrown) { console.error("查询新闻信息失败!"); } }); // 查询报道 $.ajax({ type: 'get', url: './front/media/report/getidxreport', datatype: 'json', async: true, data: { language: language }, success: function (data) { showreport(data); }, error: function (xmlhttprequest, textstatus, errorthrown) { console.error("查询报道信息失败!"); } }); // 查询控股指数 $.ajax({ type: 'get', url: './front/idx/page_link', datatype: 'json', async: true, data: { "key": 5 }, success: function (data) { showkonggu(data); }, error: function (xmlhttprequest, textstatus, errorthrown) { console.error("查询信息失败!"); } }); if (language == 3) { $(".dc_url").attr("href", "javascript:;"); } }) /** * 圆向四周扩散效果 */ function circirexpand() { $(".r-bd").find(".y2").animate({ width: "570px", height: "570px", left: "-285px", top: "-285px" }, 3000); $(".r-bd").find(".y3").animate({ width: "300px", height: "300px", left: "-150px", top: "-150px" }, 3000); $(".r-bd").find(".y4").animate({ width: "160px", height: "160px", left: "-80px", top: "-80px" }, 3000); } //显示控股数值信息 function showkonggu(data) { if (data != null && null != data.result) { $("#konggu").html(data.result.val + " "); } } // 显示轮播图信息 function showdrawing(data) { if (data != null && data.result && data.result.length > 0) { var box = $("#slides"); $(".drawing").remove(); $("#slides").html(""); for (var i in data.result) { var li = $("
  • ").addclass("drawing"); var img = $(""); if (language == 1) img.attr("src", data.result[i].piczhcn); else if (language == 2) img.attr("src", data.result[i].piczhtw); else img.attr("src", data.result[i].picen); if (data.result[i].url != "") img.attr("onclick", "window.open('"+data.result[i].url+"')"); li.append(img); box.append(li); } initslider(); } } // 显示新闻信息 function shownews(data) { if (data != null && data.result != null) { var box = $(".news_ul"); $(".news_li").remove(); // 如果第一条新闻有图片则替换 if (data.result.length > 0 && data.result[0].pic != "") { $(".news-img").html(""); } for (var i in data.result) { var date = new date(data.result[i].publishdate); if (i == 0) { if (language == 1) { box.append("
  • " + data.result[i].titlezhcn + "

    " + data.result[i].introzhcn + "

    " + date.getfullyear() + '-' + (date.getmonth() + 1) + '-' + date.getdate() + "
  • "); } else if (language == 2) { box.append("
  • " + data.result[i].titlezhtw + "

    " + data.result[i].introzhtw + "

    " + date.getfullyear() + '-' + (date.getmonth() + 1) + '-' + date.getdate() + "
  • "); } else { box.append("
  • " + data.result[i].titleen + "

    " + data.result[i].introen + "

    " + date.getfullyear() + '-' + (date.getmonth() + 1) + '-' + date.getdate() + "
  • "); } } else { if (language == 1) { box.append("
  • " + data.result[i].titlezhcn + "

    " + data.result[i].introzhcn + "

    " + date.getfullyear() + '-' + (date.getmonth() + 1) + '-' + date.getdate() + "
  • "); } else if (language == 2) { box.append("
  • " + data.result[i].titlezhtw + "

    " + data.result[i].introzhtw + "

    " + date.getfullyear() + '-' + (date.getmonth() + 1) + '-' + date.getdate() + "
  • "); } else { box.append("
  • " + data.result[i].titleen + "

    " + data.result[i].introen + "

    " + date.getfullyear() + '-' + (date.getmonth() + 1) + '-' + date.getdate() + "
  • "); } } } } } //显示报道信息 function showreport(data) { if (data != null && data.result != null) { var box = $(".report_ul"); $(".report").remove(); // 如果第一条报道有图片则替换 if (data.result.length > 0 && data.result[0].pic != "") { $(".report-img").html(""); } for (var i in data.result) { var date = new date(data.result[i].publishdate); if (i == 0) { if (language == 1) { box.append("
  • " + data.result[i].titlezhcn + "

    " + data.result[i].introzhcn + "

    " + date.getfullyear() + '-' + (date.getmonth() + 1) + '-' + date.getdate() + "
  • "); } else if (language == 2) { box.append("
  • " + data.result[i].titlezhtw + "

    " + data.result[i].introzhtw + "

    " + date.getfullyear() + '-' + (date.getmonth() + 1) + '-' + date.getdate() + "
  • "); } else { box.append("
  • " + data.result[i].titleen + "

    " + data.result[i].introen + "

    " + date.getfullyear() + '-' + (date.getmonth() + 1) + '-' + date.getdate() + "
  • "); } } else { if (language == 1) { box.append("
  • " + data.result[i].titlezhcn + "

    " + data.result[i].introzhcn + "

    " + date.getfullyear() + '-' + (date.getmonth() + 1) + '-' + date.getdate() + "
  • "); } else if (language == 2) { box.append("
  • " + data.result[i].titlezhtw + "

    " + data.result[i].introzhtw + "

    " + date.getfullyear() + '-' + (date.getmonth() + 1) + '-' + date.getdate() + "
  • "); } else { box.append("
  • " + data.result[i].titleen + "

    " + data.result[i].introen + "

    " + date.getfullyear() + '-' + (date.getmonth() + 1) + '-' + date.getdate() + "
  • "); } } } $(".report_detail").click(function () { setcookie("detail_type", $(this).data("type"));// 1-集团新闻 2-媒体报道 3-社会责任-新闻报道 4-社会责任-媒体报道 setcookie("detail_id", $(this).data("id")); window.open("media-news-details.html?detail_id="+$(this).data("id")+"&detail_type="+$(this).data("type"), "_self"); }) } } /** * 初始化图片轮播 */ function initslider() { //3.95 var _height = parseint(parseint($("body").css("width")) / 3.95); $(".banner").css("height", _height + "px"); $(".banner ul li").css("height", _height + "px"); //$(".banner ul li img").css("height", _height); var slideshowspeed = 5000; $(".flexslider").flexslider({ animation: "slide", slideshowspeed: slideshowspeed, //set the speed of the slideshow cycling, in milliseconds direction: "vertical", start: function () { //fires when the slider loads the first slide. $.each($('.flex-control-nav a'), function (_idx, _obj) { $(_obj).wrapinner(""); $(_obj).append('
    '); }) restartsliderprogressbar(); }, before: function () { //fires asynchronously with each slider animation. console.log("before"); restartsliderprogressbar(); }, after: function () { //fires after each slider animation completes. } }); } /** * 刷新图片轮播进度条 */ function restartsliderprogressbar() { if (document.slideinterval) { clearinterval(document.slideinterval); document.slideinterval = null; } document.slideintervalindex = 0; $(".banner .flex-control-nav li a .dot-running-cover").css("width", "0px"); document.slideinterval = setinterval(function () { $(".banner .flex-control-nav li a.flex-active .dot-running-cover").css("width", (document.slideintervalindex * 1.5) + "px"); document.slideintervalindex++; //console.log(document.slideintervalindex); }, 50); }