; (function ($) { window.HomeHandler = {}; HomeHandler.ServiceTimeOutId; HomeHandler.InterfaceTimeOutId; HomeHandler.ServiceShowDefaultTimeOutId; //初始化 首页Banner 数据 HomeHandler.getBannerData = function (catalogId, selectorId, urlString) { UserWeb.AjaxHandler.post({ url: urlString, data: { catalogId: catalogId, number: 20 }, noAlert: true, success: function (data) { var $parent = $(selectorId); if (data.length > 0) { $.each(data, function (key, value) { var $html = $('
'); var tempImgUrl = value.ListImage == null || value.ListImage == "" ? "/nami/Content/images/nami-banner.png" : "/nami"+value.ListImage; var tempLinkUrl = value.Chain == null ? "/nami/ArticleDetail/Index?combId=" + value.CategoryId + ',' + value.CategoryId + '&articleId=' + value.Id : value.Chain; $html.find('img').attr('src', tempImgUrl); $html.find('a').attr('href', tempLinkUrl); $parent.append($html); }); } HomeHandler.InitialBannerCarousel($parent); } }); }; //初始化 Banner UX HomeHandler.InitialBannerCarousel = function ($parent) { //banner $parent.owlCarousel({ navSpeed: 300, dotsSpeed: 400, items: 1, autoplay: true, autoplayTimeout: 3000, loop: true, dots: true }); // Custom Navigation Events $(".banner-next,.banner-next-btn").click(function () { $parent.trigger('next.owl.carousel'); }); $(".banner-prev,.banner-prev-btn").click(function () { $parent.trigger('prev.owl.carousel'); }); }; //初始化 首页纳米所介绍 数据 HomeHandler.getSingleArticleData = function (comboId, selectorId, urlString) { UserWeb.AjaxHandler.post({ url: urlString, data: { comboId: comboId }, noAlert: true, success: function (data) { var tempDescription = data.Description != null ? data.Description : "暂无"; if (data.Description != null && data.Description.length > 150) { tempDescription = data.Description.substring(0, 140) + '...'; } $(selectorId).html(tempDescription); } }); }; HomeHandler.getSingleArticleData1 = function (comboId, selectorId, urlString) { UserWeb.AjaxHandler.post({ url: urlString, data: { comboId: comboId }, noAlert: true, success: function (data) { $(selectorId).find('.index-main-panel-info').append(data.Introduction); } }); }; //初始化 首页快捷方式 数据 HomeHandler.getShortcutData = function (catalogId, selectorId, urlString) { UserWeb.AjaxHandler.post({ url: urlString, data: { catalogId: catalogId, number: 4 }, noAlert: true, success: function (data) { var $html = $('
'); $.each(data, function (index, value) { var $htmlA = $(''); $htmlA.html(value.Title); $htmlA.attr('href', value.Chain); $html.append($htmlA); }); $(selectorId).append($html); $(selectorId).children('div').first().fadeIn(200); } }); }; // 初始化 新闻资讯 数据 HomeHandler.getNewsInfoData = function (catalogId, selectorId, urlString) { UserWeb.AjaxHandler.post({ url: urlString, data: { catalogId: catalogId, number: 8, level: 2 }, noAlert: true, success: function (data) { var $html = $('
'); var $htmlnewsfirst = $('

'); var $htmlul = $(''); $.each(data, function (index, value) { var tempTitle = value.Title; var jumburl = '/nami/ArticleDetail/Index?combId=' + value.CategoryId + ',' + value.CategoryId + '&articleId=' + value.Id; var tempNewTag = ''; var tempCreatedTime = value.AddDateString; if (value.Title.length > 90) { tempTitle = value.Title.substring(0, 89) + '...'; } if (value.IsNewArticle) { tempNewTag = ''; } if (index == 0) { var tempImgUrl = value.ListImage == null ? "/nami/Content/images/dynamic-02.png" : "/nami" + value.ListImage; var tempCreatedTimeString = '发布时间:' + value.AddDateString; var tempDescription = value.Description; if (value.Description.length > 70) { tempDescription = value.Description.substring(0, 69) + '...'; } $htmlnewsfirst.find('.index-main-panel-img img').attr('src', tempImgUrl); $htmlnewsfirst.find('.index-main-panel-info a') .attr('href', jumburl) .html(tempTitle); $htmlnewsfirst.find('.index-main-panel-info h4') .append(tempNewTag); $htmlnewsfirst.find('.index-main-panel-info span') .text(tempCreatedTimeString); $htmlnewsfirst.find('.index-main-panel-info p') .html(tempDescription); } else { var $htmlulli = $('
  • '); $htmlulli.find('a') .attr('href', jumburl) .html(tempTitle); $htmlulli.find('a') .after(tempNewTag); $htmlulli.find('span') .text(tempCreatedTime); $htmlul.append($htmlulli); } }); $html.append($htmlnewsfirst); $html.append($htmlul); $(selectorId).append($html); $(selectorId).children('div').first().fadeIn(200); } }); }; HomeHandler.getNewsInfoData1 = function (catalogId, selectorId, urlString) { UserWeb.AjaxHandler.post({ url: urlString, data: { catalogId: catalogId, number: 4 }, noAlert: true, success: function (data) { var $html = $('
    '); $.each(data, function (index, value) { var tempTitle = value.Title; var jumburl = '/nami/ArticleDetail/Index?combId=' + value.CategoryId + ',' + value.CategoryId + '&articleId=' + value.Id; if (value.Title.length > 50) { tempTitle = value.Title.substring(0, 49) + '...'; } var $tempa = $(''); $tempa.attr('href', jumburl); $tempa.html(tempTitle); $html.append($tempa); }); $(selectorId).find('.index-main-panel-info').append($html); $(selectorId).find('.index-main-panel-info').children('div').first().fadeIn(200); } }); }; HomeHandler.getNewsInfoData2 = function (selectorId, urlString) { UserWeb.AjaxHandler.post({ url: urlString, data: { number: 4 }, noAlert: true, success: function (data) { var $html = $('
    '); $.each(data, function (index, value) { var tempTitle = value.Name; var jumburl = '/nami/AcademicResearchList/AcademicResearchTopicDetail?combId=3a184a47-c3ea-4226-8c79-242aa20f31d6%2C7299ed58-2740-4202-99b6-8e63ff61fbbf&topicId=' + value.Id; if (value.Name.length > 50) { tempTitle = value.Name.substring(0, 49) + '...'; } var $tempa = $(''); $tempa.attr('href', jumburl); $tempa.html(tempTitle); $html.append($tempa); }); $(selectorId).find('.index-main-panel-info').append($html); $(selectorId).find('.index-main-panel-info').children('div').first().fadeIn(200); } }); }; // 初始化 重要通知 数据 HomeHandler.getImportantInfoData = function (catalogId, selectorId, urlString) { UserWeb.AjaxHandler.post({ url: urlString, data: { catalogId: catalogId, number: 7 }, noAlert: true, success: function (data) { var $html = $('
    '); var $htmlul = $(''); $.each(data, function (index, value) { var tempTitle = value.Title; var jumburl = '/nami/ArticleDetail/Index?combId=' + value.CategoryId + ',' + value.CategoryId + '&articleId=' + value.Id; var tempNewTag = ''; var tempCreatedTime = value.AddDateString; if (value.Title.length > 90) { tempTitle = value.Title.substring(0, 89) + '...'; } if (value.IsNewArticle) { tempNewTag = ''; } var $htmlulli = $('
  • '); $htmlulli.find('a') .attr('href', jumburl) .html(tempTitle); $htmlulli.find('a') .after(tempNewTag); $htmlulli.find('span') .text(tempCreatedTime); $htmlul.append($htmlulli); }); $html.append($htmlul); $(selectorId).append($html); $(selectorId).children('div').first().fadeIn(200); } }); }; // 初始化 友情链接 数据 HomeHandler.getFriendlyLinkData = function (catalogId, selectorId, urlString) { UserWeb.AjaxHandler.post({ url: urlString, data: { catalogId: catalogId, number: 30 }, noAlert: true, success: function (data) { var $html = $('
    '); $.each(data, function (index, value) { var tempTitle = value.Title; var tempImgUrl = value.ListImage == null ? "/nami/Content/images/dynamic-02.png" : "/nami" + value.ListImage; var jumburl = value.Chain == null || value.Chain == '' ? '/nami' : value.Chain; var tempNewTag = ''; var tempCreatedTime = value.AddDateString; if (value.Title.length > 20) { tempTitle = value.Title.substring(0, 19) + '...'; } if (value.IsNewArticle) { tempNewTag = ''; } var $htmla = $(''); $htmla.attr('href', jumburl); $htmla.find('img').attr('src', tempImgUrl); $html.append($htmla); }); $(selectorId).append($html); $(selectorId).children('div').first().fadeIn(200); } }); }; // 初始化 研究所风光 数据 HomeHandler.getInstituteSceneData = function (catalogId, selectorId, urlString) { UserWeb.AjaxHandler.post({ url: urlString, data: { catalogId: catalogId, number: 4 }, noAlert: true, success: function (data) { var $html = $('
    '); $.each(data, function (index, value) { var tempTitle = value.Title; var tempImgUrl = value.ListImage == null ? "/nami/Content/images/dynamic-02.png" : "/nami" + value.ListImage; var jumburl = '/nami/ArticleDetail/Index?combId=' + value.CategoryId + ',' + value.CategoryId + '&articleId=' + value.Id; var tempNewTag = ''; var tempCreatedTime = value.AddDateString; if (value.Title.length > 20) { tempTitle = value.Title.substring(0, 19) + '...'; } if (value.IsNewArticle) { tempNewTag = ''; } var $htmldiv = $('

    '); $htmldiv.find('a').attr('href', jumburl); $htmldiv.find('a img') .attr('src', tempImgUrl) .attr('alt', tempTitle); $htmldiv.find('p') .html(tempTitle); $html.append($htmldiv); }); $(selectorId).append($html); $(selectorId).children('div').first().fadeIn(200); } }); }; //初始化 根据栏目id获取数据 HomeHandler.getHomeArtileListDataById = function (catalogId, selectorId, urlString, getCount) { UserWeb.AjaxHandler.post({ url: urlString, data: { catalogId: catalogId, number: getCount }, noAlert: true, success: function (data) { var $html = $('
    '); $.each(data, function (index, value) { var $htmlA = $(''); $htmlA.html(value.Title); $htmlA.attr('href', value.Chain); $html.append($htmlA); }); $(selectorId).append($html); $(selectorId).children('div').first().fadeIn(200); } }); }; //初始化 特色服务 数据 HomeHandler.getServiceData = function (catalogId, selectorId, urlString) { UserWeb.AjaxHandler.post({ url: urlString, data: { catalogId: catalogId, number: 10 }, noAlert: true, success: function (data) { var $selector = $(selectorId).find('.row.service-type'); $.each(data, function (index, value) { var tempImgUrl = value.ListImage == null || value.ListImage == "" ? "/Content/images/xas-service-phone.png" : value.ListImage; var $html = $(''); $html.attr('src', tempImgUrl); $html.css('display', 'none'); $($selector[index]).append($html); }); } }); HomeHandler.InitialServiceCarousel(); $('.service-show').css('height', $('.service-show img').height()); }; //初始化 特色服务 UX HomeHandler.InitialServiceCarousel = function () { var serviceWaypoint = $('#serviceanimationstart').waypoint({ handler: function () { var $serviceleft = $('#service-main-left'); var $serviceright = $('#service-main-right'); var serviceSequence = []; if ($serviceleft.css('display') == 'none') { //alert('hello service'); //$('#service-main-middle .service-type-middle-icon').css('display', ''); //$('#service-main-middle .service-type-middle-icon').velocity("fadeIn", { display: 'block' }); //$('#service-main-middle .service-type-middle-icon').position({ // my: 'center', // at: 'center', // of: '#service-main-middle img' //}); //$('#service-main-middle .service-type-middle-icon') // .velocity('callout.flash') // .velocity('fadeOut'); //var $serviceimage = $('#service-main-middle img'); //var offset = $serviceimage.offset(); //var width = $serviceimage.width(); //var height = $serviceimage.height(); //var serviceCenterX = offset.left + width / 2; //var serviceCenterY = offset.top + height / 2; var animationOptions = { duration: 950, easing: "ease-in-out" }; $serviceleft.children('.row').each(function (index, element) { var $element = $(element); $element.css('display', 'none'); serviceSequence.push({ e: $element, p: 'transition.slideUpIn', o: { sequenceQueue: false, delay: 100, duration: 400 } }); }); $serviceright.children('.row').each(function (index, element) { var $element = $(element); $element.css('display', 'none'); serviceSequence.push({ e: $element, p: 'transition.slideUpIn', o: { sequenceQueue: false, delay: 100, duration: 400 } }); }); $serviceleft.velocity("fadeIn", { display: 'block' }); $serviceright.velocity("fadeIn", { display: 'block' }); $.Velocity.RunSequence(serviceSequence); //add clicked class for first service type //$('.service-type-phone').addClass('service-clicked'); //var $serviceShow = $('.service-show'); //var $serviceShowDefault = $serviceShow.find('.service-type-defaultimg'); //$serviceShowDefault.after($this.find('.service-type-img').clone()); //var $serviceShowNew = $serviceShow.find('.service-type-img'); //var $parent = $this.parent('div'); //var $thistext = $this.children('.service-type-name'); //var $thisicon = $this.children('.service-type-icon'); //var $thisiconp = $thisicon.children('p'); //var $thisiconpspan = $thisiconp.children('span'); //var thisSequence = []; //if ($parent.attr('id') == 'service-main-left') { // thisSequence.push({ e: $this, p: { translateX: '-=30' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); //} else { // thisSequence.push({ e: $this, p: { translateX: '+=30' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); //} //thisSequence.push({ e: $thisiconp, p: { backgroundColor: '#d8271c' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); //thisSequence.push({ e: $thisiconpspan, p: { color: '#fff' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); //thisSequence.push({ e: $serviceShowDefault, p: 'fadeOut', o: { sequenceQueue: false, delay: 0, duration: 0 } }); //thisSequence.push({ e: $serviceShowNew, p: 'fadeIn', o: { sequenceQueue: true, delay: 10, duration: 50 } }); //$.Velocity.RunSequence(thisSequence); $('.row.service-type').each(function (index, element) { var $element = $(element); $element.on('click', function () { var $this = $(this); if (HomeHandler.ServiceTimeOutId) { window.clearTimeout(HomeHandler.ServiceTimeOutId); HomeHandler.ServiceTimeOutId = null; } if (!$this.hasClass('service-clicked')) { var $currentClicked = $('.row.service-type.service-clicked'); if ($currentClicked.length > 0) { var $serviceShow = $('.service-show'); var $serviceShowDefault = $serviceShow.find('.service-type-defaultimg'); var $serviceShowNew = $serviceShow.find('.service-type-img'); var $parent = $currentClicked.parent('div'); var $thistext = $currentClicked.children('.service-type-name'); var $thisicon = $currentClicked.children('.service-type-icon'); var $thisiconp = $thisicon.children('p'); var $thisiconpspan = $thisiconp.children('span'); var thisSequence = []; if ($parent.attr('id') == 'service-main-left') { thisSequence.push({ e: $currentClicked, p: { translateX: '+=30' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); } else { thisSequence.push({ e: $currentClicked, p: { translateX: '-=30' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); } thisSequence.push({ e: $thisiconp, p: { backgroundColor: '#fff' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); thisSequence.push({ e: $thisiconpspan, p: { color: '#d8271c' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); thisSequence.push({ e: $serviceShowNew, p: 'fadeOut', o: { sequenceQueue: false, delay: 0, duration: 0 } }); thisSequence.push({ e: $serviceShowDefault, p: 'fadeIn', o: { sequenceQueue: true, delay: 10, duration: 50 } }); $.Velocity.RunSequence(thisSequence); $serviceShowNew.remove(); } $this.addClass('service-clicked'); var $serviceShow = $('.service-show'); var $serviceShowDefault = $serviceShow.find('.service-type-defaultimg'); $serviceShowDefault.after($this.find('.service-type-img').clone()); var $serviceShowNew = $serviceShow.find('.service-type-img'); var $parent = $this.parent('div'); var $thistext = $this.children('.service-type-name'); var $thisicon = $this.children('.service-type-icon'); var $thisiconp = $thisicon.children('p'); var $thisiconpspan = $thisiconp.children('span'); var thisSequence = []; if ($parent.attr('id') == 'service-main-left') { thisSequence.push({ e: $this, p: { translateX: '-=30' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); } else { thisSequence.push({ e: $this, p: { translateX: '+=30' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); } thisSequence.push({ e: $thisiconp, p: { backgroundColor: '#d8271c' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); thisSequence.push({ e: $thisiconpspan, p: { color: '#fff' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); thisSequence.push({ e: $serviceShowDefault, p: 'fadeOut', o: { sequenceQueue: false, delay: 0, duration: 0 } }); thisSequence.push({ e: $serviceShowNew, p: 'fadeIn', o: { sequenceQueue: true, delay: 10, duration: 50 } }); $.Velocity.RunSequence(thisSequence); } }); $element.hover(function () { var $this = $(this); if (!$this.hasClass('service-clicked')) { if (!HomeHandler.ServiceTimeOutId) { HomeHandler.ServiceTimeOutId = window.setTimeout(function () { HomeHandler.ServiceTimeOutId = null; var $serviceShow = $('.service-show'); var $serviceShowDefault = $serviceShow.find('.service-type-defaultimg'); $serviceShowDefault.after($this.find('.service-type-img').clone()); var $serviceShowNew = $serviceShow.find('.service-type-img'); var $parent = $this.parent('div'); var $thistext = $this.children('.service-type-name'); var $thisicon = $this.children('.service-type-icon'); var $thisiconp = $thisicon.children('p'); var $thisiconpspan = $thisiconp.children('span'); var thisSequenceArray = []; if ($parent.attr('id') == 'service-main-left') { thisSequenceArray.push({ e: $this, p: { translateX: '-=30' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); } else { thisSequenceArray.push({ e: $this, p: { translateX: '+=30' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); } thisSequenceArray.push({ e: $thisiconp, p: { backgroundColor: '#d8271c' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); thisSequenceArray.push({ e: $thisiconpspan, p: { color: '#fff' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); //if (!HomeHandler.ServiceShowDefaultTimeOutId) { // HomeHandler.ServiceShowDefaultTimeOutId = window.setTimeout( // function () { // HomeHandler.ServiceShowDefaultTimeOutId = null; // if ($serviceShowDefault.css('display') != 'none') { // thisSequenceArray.push({ e: $serviceShowDefault, p: 'transition.slideDownOut', o: { sequenceQueue: false, delay: 0, duration: 0 } }); // } // }, 100); //} thisSequenceArray.push({ e: $serviceShowDefault, p: 'transition.slideDownOut', o: { sequenceQueue: false, delay: 0, duration: 0 } }); thisSequenceArray.push({ e: $serviceShowNew, p: 'transition.slideDownIn', o: { sequenceQueue: true, delay: 10, duration: 50 } }); $this.velocity('stop', true); $thisiconp.velocity('stop', true); $thisiconpspan.velocity('stop', true); $serviceShowNew.velocity('stop', true); $serviceShowDefault.velocity('stop', true); $this.velocity('reverse'); $thisiconp.velocity('reverse'); $thisiconpspan.velocity('reverse'); $serviceShowNew.velocity('reverse'); $serviceShowDefault.velocity('reverse'); var thisSequence = $.Velocity.RunSequence(thisSequenceArray); }, 10); } } } , function () { var $this = $(this); if (!$this.hasClass('service-clicked')) { if (HomeHandler.ServiceTimeOutId) { window.clearTimeout(HomeHandler.ServiceTimeOutId); HomeHandler.ServiceTimeOutId = null; } else { var $this = $(this); var $serviceShow = $('.service-show'); var $serviceShowDefault = $serviceShow.find('.service-type-defaultimg'); var $serviceShowNew = $serviceShow.find('.service-type-img'); var $parent = $this.parent('div'); var $thistext = $this.children('.service-type-name'); var $thisicon = $this.children('.service-type-icon'); var $thisiconp = $thisicon.children('p'); var $thisiconpspan = $thisiconp.children('span'); var thisSequenceArray = []; if ($parent.attr('id') == 'service-main-left') { thisSequenceArray.push({ e: $this, p: { translateX: '+=30' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); } else { thisSequenceArray.push({ e: $this, p: { translateX: '-=30' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); } thisSequenceArray.push({ e: $thisiconp, p: { backgroundColor: '#fff' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); thisSequenceArray.push({ e: $thisiconpspan, p: { color: '#d8271c' }, o: { sequenceQueue: false, delay: 70, duration: 260 } }); thisSequenceArray.push({ e: $serviceShowNew, p: 'transition.slideDownOut', o: { sequenceQueue: false, delay: 0, duration: 0 } }); thisSequenceArray.push({ e: $serviceShowDefault, p: 'transition.slideDownIn', o: { sequenceQueue: true, delay: 10, duration: 50 } }); $this.velocity('stop', true); $thisiconp.velocity('stop', true); $thisiconpspan.velocity('stop', true); $serviceShowNew.velocity('stop', true); $serviceShowDefault.velocity('stop', true); $this.velocity('reverse'); $thisiconp.velocity('reverse'); $thisiconpspan.velocity('reverse'); $serviceShowNew.velocity('reverse'); $serviceShowDefault.velocity('reverse'); var thisSequence = $.Velocity.RunSequence(thisSequenceArray); //thisSequence.velocity('run'); //thisSequence.velocity('stop'); //thisSequence.velocity('finish'); //thisSequence.velocity('reverse'); $serviceShowNew.remove(); } } }); }); } }, offset: '128%' }); }; //初始化 首页界面展示 数据 HomeHandler.getInterfaceData = function (catalogId, selectorId, urlString) { UserWeb.AjaxHandler.post({ url: urlString, data: { catalogId: catalogId, number: 8 }, noAlert: true, success: function (data) { var $interface = $(selectorId); $.each(data, function (index, value) { var $html = $(''); var tempTitle = value.Title; if (value.Title.length > 30) { tempTitle = value.Title.substring(0, 29) + '...'; } var tempImgUrl = value.ListImage == null || value.ListImage == "" ? "/Content/images/interface-pic1.png" : value.ListImage; $html.find('.index-interface-img-info img').attr('src', tempImgUrl); $html.find('.index-interface-img-name').html(tempTitle); $interface.append($html); }); HomeHandler.InitialInterfaceCarousel(); } }); }; ////初始化 首页界面展示 UX HomeHandler.InitialInterfaceCarousel = function () { var interfaceWaypoint = $('#interfaceanimationstart').waypoint({ handler: function () { var $interfaceOwl = $("#rolling-interface"); var $owlActiveitems = $('#rolling-interface .owl-item.active'); var interfaceSequence = []; var pageSize = 0; if ($interfaceOwl.css('display') == 'none') { //interface $interfaceOwl.owlCarousel({ autoplay: true, autoplayTimeout: 5000, autoplayHoverPause: true, navSpeed: 500, items: 3, loop: true, onResize: function (event) { }, onInitialized: function (event) { pageSize = event.page.size; //var $owlitems = $('#rolling-interface .owl-item'); //$('.index-interface').css('display', ''); //$interfaceOwl.css('display', ''); //$owlitems.each(function (index, element) { // var $element = $(element); // $element.css('display', 'none'); // interfaceSequence.push({ e: $element, p: 'transition.slideLeftIn', o: { sequenceQueue: true, delay: 100, duration: 400 } }); // //if (index < pageSize) { // // interfaceSequence.push({ e: $element, p: 'transition.slideLeftIn', o: { sequenceQueue: true, delay: 100, duration: 400 } }); // //} //}); }, onTranslate: function (event) { $('#index-interface-scrollbar p').velocity({ width: 0 }, { duration: 20 }); setTimeout(function () { $('#index-interface-scrollbar p').velocity({ width: '100%' }, { duration: 4960 }); }, 20); }, responsive: { // breakpoint from 0 up 0: { items: 1 }, // breakpoint from 480 up 480: { items: 2 }, // breakpoint from 979 up 979: { navSpeed: 600, items: 3 }, // breakpoint from 1199 up 1199: { navSpeed: 600, items: 3 } } }); //$.Velocity.RunSequence(interfaceSequence); //setTimeout(function () { // var $interfaceImgSequence = []; // $('.index-interface') // .find('.owl-item.active .index-interface-img-info img') // .each(function () { // var $this = $(this); // $interfaceImgSequence.push({ e: $this, p: 'transition.slideLeftIn', o: { sequenceQueue: true, delay: 20, duration: 300 } }); // }); // $.Velocity.RunSequence($interfaceImgSequence); // $('.index-interface') // .find('.index-interface-img-info img') // .each(function () { // var $this = $(this); // if ($this.css('display') == 'none') { // $this.css('display', ''); // } // }); //}, 300); $('.index-interface').css('display', ''); $interfaceOwl.velocity('fadeIn', { display: 'block' }); setTimeout(function () { var interfaceImgSequence = []; $interfaceOwl.find('.index-interface-img') .each(function () { var $this = $(this); $this.css('display', ''); //interfaceImgSequence.push({ e: $this, p: 'transition.slideLeftIn', o: { sequenceQueue: true, delay: 20, duration: 300 } }); }); //$.Velocity.RunSequence(interfaceImgSequence); setTimeout(function () { $('#index-interface-scrollbar p').velocity({ width: '100%' }, { duration: 4360 }); }, 200); }, 450); $(document).on('mouseenter', '#rolling-interface .owl-item.active', function () { var $interfaceimg = $(this).find('.index-interface-img-name'); if (!HomeHandler.InterfaceTimeOutId) { HomeHandler.InterfaceTimeOutId = window.setTimeout(function () { HomeHandler.InterfaceTimeOutId = null; if ($interfaceimg.css('display') == 'none') { $interfaceimg.velocity('transition.slideUpIn', { duration: 200 }); } }, 300); } }); $(document).on('mouseleave', '#rolling-interface .owl-item.active', function () { if (HomeHandler.InterfaceTimeOutId) { window.clearTimeout(HomeHandler.InterfaceTimeOutId); HomeHandler.InterfaceTimeOutId = null; } else { var $interfaceimg = $(this).find('.index-interface-img-name'); if ($interfaceimg.css('display') != 'none') { $interfaceimg.velocity('transition.slideDownOut', { duration: 200 }); } } }); } }, offset: '85%' }); }; //初始化 首页合作品牌 数据 HomeHandler.getCooperationData = function (selectorId, urlString) { UserWeb.AjaxHandler.post({ url: urlString, noAlert: true, success: function (data) { var $cooperation = $(selectorId); var htmlstring = ''; $.each(data, function (index, value) { var tempWorkUnitTitle = value.Name; if (tempWorkUnitTitle.length > 30) { tempWorkUnitTitle = tempWorkUnitTitle.substring(0, 29) + '...'; } var tempImgUrl = value.ImgUrl == null || value.ImgUrl == "" ? "/Content/images/index-brand-pic.png" : value.ImgUrl; var tempDescription = value.Description; if (tempDescription.length > 90) { tempDescription = tempDescription.substring(0, 89) + '...'; } var tempHeadImgUrl = value.CooperationInfo.HeadPicture == null || value.CooperationInfo.HeadPicture == "" ? "/Content/images/index-brand-avatar.png" : value.CooperationInfo.HeadPicture; var tempHeadNickName = value.CooperationInfo.ExpertTitleForDisplay; var $html = $(htmlstring); $html.find('.index-brands-list-img img').attr('src', tempImgUrl); $html.find('.index-brands-list-info-avatar img').attr('src', tempHeadImgUrl); $html.find('.index-brands-list-info-name h4').html(tempHeadNickName); $html.find('.index-brands-list-info-name p').html(tempWorkUnitTitle); $html.find('.index-brands-list-comment p').html(tempDescription); if (index % 2 == 1) { $html.addClass('index-brands-down'); } $cooperation.append($html); }); HomeHandler.InitialCooperationCarousel(); } }); }; //初始化 首页合作品牌 UX HomeHandler.InitialCooperationCarousel = function () { var brandsWaypoint = $('#brandsanimationstart').waypoint({ handler: function () { if ($('#rolling-brands').css('display') == 'none') { //alert('hello brands'); //brands var $rollingBrands = $("#rolling-brands"); $rollingBrands.owlCarousel({ navSpeed: 600, items: 4, loop: false, onInitialized: function (event) { }, responsive: { // breakpoint from 0 up 0: { items: 1 }, // breakpoint from 480 up 480: { items: 3 }, // breakpoint from 979 up 979: { navSpeed: 600, items: 4 }, // breakpoint from 1199 up 1199: { navSpeed: 600, items: 4 } }, onResize: function (event) { }, onTranslate: function (event) { //var $OutElement = $($(event.target).find('.owl-item')[event.item.index - 1]); //var $InElement = $($(event.target).find('.owl-item')[event.item.index + event.page.size - 1]); //if ($OutElement.find('.item').hasClass('index-brands-down')) { // $OutElement.velocity('transition.slideUpOut'); // $InElement.velocity('transition.slideUpIn'); //} else { // $OutElement.velocity('transition.slideDownOut'); // $InElement.velocity('transition.slideDownIn'); //} }, onTranslated: function (event) { //var $OutElement = $($(event.target).find('.owl-item')[event.item.index - 1]); //var $InElement = $($(event.target).find('.owl-item')[event.item.index + event.page.size - 1]); //if ($OutElement.find('.item').hasClass('index-brands-down')) { // $OutElement.velocity('transition.slideUpOut'); // $InElement.velocity('transition.slideUpIn'); //} else { // $OutElement.velocity('transition.slideDownOut'); // $InElement.velocity('transition.slideDownIn'); //} } }); $(".next").click(function () { $rollingBrands.trigger('next.owl.carousel'); }); $(".prev").click(function () { $rollingBrands.trigger('prev.owl.carousel'); }); var $owlitems = $('#rolling-brands .owl-item'); var brandsSequence = []; $('.index-brands').css('display', ''); $('#rolling-brands').css('display', ''); $('#rolling-brands') .find('.item') .each(function (index, element) { var $element = $(element); if ($element.hasClass('.index-brands-down').length > 0) { brandsSequence.push({ e: $element, p: 'transition.slideUpIn', o: { sequenceQueue: true, delay: 100, duration: 400 } }); } else { brandsSequence.push({ e: $element, p: 'transition.slideDownIn', o: { sequenceQueue: true, delay: 100, duration: 400 } }); } }); setTimeout(function () { $.Velocity.RunSequence(brandsSequence); }, 400); } }, offset: '45%' }); }; //初始化 首页单个文章链接 数据 HomeHandler.getHomeFirstArticleData = function (catalogId, selectorIds, urlString) { UserWeb.AjaxHandler.post({ url: urlString, data: { catalogId: catalogId }, noAlert: true, success: function (data) { var selectors = selectorIds.split(','); var linkString = data.PageUrl == null || data.PageUrl == '' ? 'javascript:;' : data.PageUrl; $.each(selectors, function (key, value) { $(value).attr('href', linkString); }); } }); }; //首页页面大小调整 HomeHandler.fnWindowResize = function () { $(window).resize(function () { $('.service-show').css('height', $('.service-show img').height()); }); }; HomeHandler.fnChangeData = function (node) { var $this = $(node); var $parentli = $this.closest('li'); var $parentul = $this.closest('ul'); if ($parentli.hasClass('index-mobile-tab-active')) { return; } else { generatedCount = 1; $('.index-mobile-content #scroller #index-main-mobile-list').html(''); $parentul.children('.index-mobile-tab-active').removeClass('index-mobile-tab-active'); $parentli.addClass('index-mobile-tab-active'); var catalogId = $this.data('catalogid'); UserWeb.AjaxHandler.post({ url: '@Url.Action("GetHomeArticleList", "Home")', data: { catalogId: catalogId, number: 6 }, noAlert: true, success: function (data) { var mobilehtmlstring = ''; $.each(data, function (index, value) { var tempTitle = value.Title; var tempMobileImgUrl = value.ListImage == null || value.ListImage == "" ? "/Content/images/news-pic.png" : value.ListImage; if (value.Title.length > 30) { tempTitle = value.Title.substring(0, 29) + '...'; } mobilehtmlstring += '
    ' + '' + '

    ' + tempTitle + '

    ' + '

    作者:' + value.AuthorName + ' 发表于:' + value.AddDateString + '

    '; }); $('.index-mobile-content #scroller #index-main-mobile-list').append(mobilehtmlstring); } }); } }; })(jQuery);