苏州创新投资
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
suzhou/js/index.js

525 lines
17 KiB

(function($){
$.fn.numberRock=function(options){
var defaults={
lastNumber:100,
duration:3000,
easing:'swing' //swing(默认 : 缓冲 : 慢快慢) linear(匀速的)
};
var opts=$.extend({}, defaults, options);
$(this).animate({
num : "numberRock",
},{
duration : opts.duration,
easing : opts.easing,
complete : function(){
// console.log("success");
},
step : function(a,b){
$(this).html(parseInt(b.pos * opts.lastNumber));
}
});
}
if($(window).width()<=767){
$(".section6").removeClass('fp-auto-height').css('background',"#30343c")
$(".footer-top").css('paddingTop','70px')
}else{
}
})(jQuery);
//banner
$(function(){
// $('#header').load('public/header1.html')
$("#header").load("public/header1.html","",function(){
//移动端展开nav
$('#navToggle').on('click',function(){
$('.m_nav').addClass('open');
})
//关闭nav
$('.m_nav .top .closed').on('click',function(){
$('.m_nav').removeClass('open');
})
//二级导航 移动端
$(".m_nav .ul li").click(function() {
$(this).children("div.dropdown_menu").slideToggle('slow')
$(this).siblings('li').children('.dropdown_menu').slideUp('slow');
});
});
//判断是否在可视区内部
function isVisible(selectid) {
console.log(selectid)
var o;
if ('object' === typeof selectid) {
o = selectid;
} else {
o = $(selectid);
}
var of = o.offset();
var w = $(window);
return !(w.scrollTop() > (of.top + o.outerHeight()) || (w.scrollTop() + w.height()) < of.top);
}
$('.index_banner').slick({
autoplay: false,
arrows: false,
dots:false,
infinite: true,
speed: 1000,
autoplaySpeed: 2000,
pauseOnHover: false,
fade: false,
responsive: [
{
breakpoint: 992,
settings: {
dots: true
}
}
]
});
$('.electricItem').mouseenter(function(){
$(this).addClass('section3active').parent().siblings().children().removeClass('section3active')
if($(this).children()[1].innerText=='先进材料'){
$('.section3').addClass('xianjincailiao').fadeIn().removeClass('zhuangbeizhizao dianxixinxi yiyaoshengwu');
$('.second3Title>.title').animate({'opacity': 0}, 400, function(){
$('.second3Title>.title').html('先进材料').animate({'opacity': 1}, 500);
})
$('.second3Title>p').animate({'opacity': 0}, 400, function(){
$('.second3Title>p').html('ADVANCED<br>MATERIALS').animate({'opacity': 1}, 500);
})
$('.second3Title>.textsecond3').animate({'opacity': 0}, 400, function(){
$('.second3Title>.textsecond3').html('重点关注先进钢铁材料、先进有色金属材料、先进石化化工新材料、先进无机非金属材料、高性能纤维及制品和复合材料、前沿新材料等领域').animate({'opacity': 1}, 500);
})
}
if($(this).children()[1].innerText=='装备制造'){
$('.section3').addClass('zhuangbeizhizao').removeClass('xianjincailiao dianxixinxi yiyaoshengwu');
$('.second3Title>.title').animate({'opacity': 0}, 400, function(){
$('.second3Title>.title').html('装备制造').animate({'opacity': 1}, 500);
})
$('.second3Title>p').animate({'opacity': 0}, 400, function(){
$('.second3Title>p').html('EQUIPMENT<br>MAFUFACTURING').animate({'opacity': 1}, 500);
})
$('.second3Title>.textsecond3').animate({'opacity': 0}, 400, function(){
$('.second3Title>.textsecond3').html('重点关注高端装备、新能源、汽车及零部件、航空航天等领域').animate({'opacity': 1}, 500);
})
}
if($(this).children()[1].innerText=='电子信息'){
$('.section3').addClass('dianxixinxi').removeClass('xianjincailiao zhuangbeizhizao yiyaoshengwu')
$('.second3Title>.title').animate({'opacity': 0}, 400, function(){
$('.second3Title>.title').html('电子信息').animate({'opacity': 1}, 500);
})
$('.second3Title>p').animate({'opacity': 0}, 400, function(){
$('.second3Title>p').html('ELECTRONIC<br>INFORMATION').animate({'opacity': 1}, 500);
})
$('.second3Title>.textsecond3').animate({'opacity': 0}, 400, function(){
$('.second3Title>.textsecond3').html('重点关注计算机与智能消费设备制造、信息通信、新型显示、集成电路、电子元器件与专用材料产业、人工智能等领域').animate({'opacity': 1}, 500);
})
}
if($(this).children()[1].innerText=='生物医药'){
$('.section3').addClass('yiyaoshengwu').removeClass('xianjincailiao zhuangbeizhizao dianxixinxi');
$('.second3Title>.title').animate({'opacity': 0}, 400, function(){
$('.second3Title>.title').html('生物医药').animate({'opacity': 1}, 500);
})
$('.second3Title>p').animate({'opacity': 0}, 400, function(){
$('.second3Title>p').html('BIOMEDICINE').animate({'opacity': 1}, 500);
})
$('.second3Title>.textsecond3').animate({'opacity': 0}, 400, function(){
$('.second3Title>.textsecond3').html('重点关注创新医药、高端医疗器械、CXO(合同研发生产组织)、BT(生物技术)+IT(信息技术)融合、产业链配套、商贸供应链、医疗健康服务等领域').animate({'opacity': 1}, 500);
})
}
})
$('.index_banner').init(function(slick){
$('.index_banner .item.slick-current').addClass('active').siblings().removeClass('active')
})
$('.index_banner').on('afterChange',function(slick,currentSlide){
$('.index_banner .item.slick-current').addClass('active').siblings().removeClass('active');
var _index = $('.index_banner').slick('slickCurrentSlide')
$('.section1 .number span').eq(_index).addClass('active').siblings().removeClass('active')
})
$('.section1 .number span').click(function(){
var _index = $(this).index();
$('.index_banner').slick('slickGoTo',_index);
$(this).addClass("active").siblings().removeClass("active")
});
$('.section1 .prev').click(function(){
$('.index_banner').slick('slickPrev')
})
$('.section1 .next').click(function(){
$('.index_banner').slick('slickNext');
});
$('.formContent').click(function(){
$(".qingdan").show();
$('#index_main').hide()
$(".close").click(function(){
$('#index_main').show()
$(".qingdan").hide();
})
});
$('.closeFlag').click(function(event){
event.stopPropagation()
$('.formContent').hide()
});
//导航
//超过一定高度导航添加类名
var nav=$("header"); //得到导航对象
var win=$(window); //得到窗口对象
var sc=$(document);//得到document文档对象。
win.scroll(function(){
})
// 流动效果
function groupSlide(){
imgScroll.rolling({
name:'g1',
width:'198px',
height:'116px',
direction:'left',
speed:10,
addcss:true
});
imgScroll.rolling({
name:'g2',
width:'198px',
height:'116px',
direction:'right',
speed:10,
addcss:true
});
imgScroll.rolling({
name:'g3',
width:'198px',
height:'116px',
direction:'left',
speed:10,
addcss:true
});
}
function groupSlide1(){
imgScroll.rolling({
name:'g1',
width:'119px',
height:'70px',
direction:'left',
speed:10,
addcss:true
});
imgScroll.rolling({
name:'g2',
width:'119px',
height:'70px',
direction:'right',
speed:10,
addcss:true
});
imgScroll.rolling({
name:'g3',
width:'119px',
height:'70px',
direction:'left',
speed:10,
addcss:true
});
}
//全屏滚动
if($(".qingdan").css('display')=='none'){
$('#index_main').fullpage({
'navigation': true,
scrollBar: false,
slidesNavigation: true,
css3: true,
controlArrows: false,
continuousHorizontal:true,
scrollingSpeed:500,
showActiveTooltip :true,
loopHorizontal: true,
afterLoad: function(anchorLink, index){
console.log(index)
if(index == 1){
$('header').removeClass('on').addClass("animation");
}
if(index == 2){
$('header').addClass('on').addClass("animation");
var _txt1 = $(".number1").attr('data-val');
var _txt2 = $(".number2").attr('data-val');
var _txt3 = $(".number3").attr('data-val');
$(".number1").numberRock({
lastNumber:_txt1,
duration:2000,
easing:'swing',
});
$(".number2").numberRock({
lastNumber:_txt2,
duration:2000,
easing:'swing',
});
$(".number3").numberRock({
lastNumber:_txt3,
duration:2000,
easing:'swing',
});
}
if(index == 3){
$('header').removeClass('on').addClass("animation");
}
if(index == 4){
$('header').addClass('on').addClass("animation");
}
if(index == 5){
$('header').removeClass('on').addClass("animation");
}
if(index == 6){
$('header').addClass('on').addClass("animation");
}
},
afterSlideLoad:function(){
},
afterRender: function(){
},
onLeave: function(index, direction){
if(index === 1){
$(".header").removeClass("animation");
}else if(index==2){
$(".number1")[0].innerHTML = 0
$(".number2")[0].innerHTML = 0
$(".number3")[0].innerHTML = 0;
$(".header").removeClass("animation");
}else{
$(".header").removeClass("animation");
}
}
})
}
$.ajax({
url: "https://suzhou.njrenzhou.cn/api.php/index/cateGory",
type: "POST",
data: {},
success: function (res) {
let html = ''
let data = res.data
data.forEach((item,index)=>{
if(index==0){
html+=`<div class="titleItem titleItemActive" data-id='${item.id}'>${item.title}</div>`
news01_render(item.id)
}else{
html+=`<div class="titleItem" data-id='${item.id}'>${item.title}</div>`
}
})
$(".titleContent").append(html)
$('.newsLeftContent>a').attr('href','http://sct.njrenzhou.cn/news/news01.html')
$('.titleContent .titleItem').click(function(){
console.log($(this))
if($(this).attr('class').indexOf('titleItemActive')!=-1){
// news01_render($(this)[0].dataset.id)
}else{
$(this).addClass('titleItemActive').siblings().removeClass('titleItemActive');
news01_render($(this)[0].dataset.id)
}
if($('.titleItemActive')[0].dataset.id==11){
$('.newsLeftContent>a').attr('href','http://sct.njrenzhou.cn/news/news01.html')
}
if($('.titleItemActive')[0].dataset.id==13){
$('.newsLeftContent>a').attr('href','http://sct.njrenzhou.cn/news/news02.html')
}
if($('.titleItemActive')[0].dataset.id==35){
$('.newsLeftContent>a').attr('href','http://sct.njrenzhou.cn/news/news03.html')
}
})
},
error: function (err) {
console.log(err);
}
})
function starList(){
$.ajax({
type: 'post',
url: 'https://suzhou.njrenzhou.cn/api.php/busmap/starProject',
dataType: 'json',
data:{
limit:100000
},
success: function (res) {
console.log(Math.floor(res.data.total/3))
let num = Math.floor(res.data.total/3)
let data = res.data.data
let firstList = data.slice(0,num);
let secondList = data.slice(num,num*2);
let thirdList = data.slice(num*2,num*3);
let forthList = data
let html=''
let html1=''
let html2=''
let html3=''
firstList.forEach((item,index)=>{
html+=`<li><img src="https://suzhou.njrenzhou.cn${item.thumb}"></li>`
})
secondList.forEach((item,index)=>{
html1+=`<li><img src="https://suzhou.njrenzhou.cn${item.thumb}"></li>`
})
thirdList.forEach((item,index)=>{
html2+=`<li><img src="https://suzhou.njrenzhou.cn${item.thumb}"></li>`
})
// forthList.forEach((item,index)=>{
// html3+=`<img src="https://suzhou.njrenzhou.cn${item.thumb}">`
// })
// if((forthList.length)%6)
$('.mobileIcon').css('width',(Math.ceil(forthList.length)/6)*100+'%')
$('.g1 ul').append(html)
$('.g2 ul').append(html1)
$('.g3 ul').append(html2)
// $('.mobileIcon').append(html3)
//
console.log($(window).width())
if($(window).width()<=767){
groupSlide1()
}else{
groupSlide()
}
}
})
}
starList()
$.ajax({
type: 'post',
url: 'https://suzhou.njrenzhou.cn/api.php/index/relatedLink',
dataType: 'json',
data:{
},
success: function (res) {
let html=''
let datalist = res.data.data.reverse()
datalist.forEach((item,index)=>{
html+=`<option value ="${item.url}">${item.title}</option>`
})
$('.select').append(html)
$('.select').change(function(){
// let oWindow = window.open('', '_blank');
if($(this).val()){
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
if(isiOS){
window.location.href = $(this).val()
}else{
window.open($(this).val());
}
if(/android/i.test(navigator.userAgent)){
}
if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)){
}else{
}
}
})
}
})
})
function news01_render(categoryId){
$.ajax({
type: 'post',
url: 'https://suzhou.njrenzhou.cn/api.php/index/articleList',
data:{
category_id:categoryId,
order:'desc',
sort:'publish_time'
},
dataType: 'json',
success: function (res) {
if(res.code==200){
let html = ''
let data = res.data.data;
data.forEach((item,index)=>{
html+=`<div class="brand__thumb category__item transition-3" data-id=${item.id}>
<div class="imgcontainer transition-3" style="background:url(https://suzhou.njrenzhou.cn${item.thumb});background-size: cover;background-repeat: no-repeat;background-position: center;">
</div>
<div class="contentText transition-3">
<div class="contenttitle">${item.title}</div>
<p>${item.subtitle}</p>
<div class="time">${item.publish_time_text.split(' ')[0]}</div>
</div>
</div>`
})
$('.brand__slider').empty().append(html)
$(".brand__slider").trigger("destroy.owl.carousel")
$('.brand__slider').owlCarousel({
loop:true,
margin:30,
autoplay:false,
autoplayTimeout:3000,
smartSpeed:500,
items:3,
navText:['<button><i class="fal fa-angle-left"></i></button>','<button><i class="fal fa-angle-right"></i></button>'],
nav:false,
dots:false,
responsive:{
0:{
items:1
},
576:{
items:2
},
767:{
items:3
},
},
})
$('.category__item').click(function(){
window.open("/news/detail.html?id="+ $(this)[0].dataset.id);
})
}
},
error: function (err) {
console.log(err);
}
});
}
// 公共信息-基本信息
function getBasics(){
$.ajax({
type: 'post',
url: 'https://suzhou.njrenzhou.cn/api.php/index/getBasics',
data:{
group:'basics'
},
dataType: 'json',
success: function (res) {
if(res.code==200){
var data = res.data;
// 头部信息
// $('meta')[3].content = data[2].value;
// $('meta')[4].content = data[3].value;
$('link')[0].href = 'https://suzhou.njrenzhou.cn' + data[14].value;
// 底部信息
$('#basicsQrcode').append("<img src='https://suzhou.njrenzhou.cn" + data[22].value + "'>");
$('#basicsFooter').append("@2022-2032&nbsp;苏州创新投资集团有限公司&nbsp;&nbsp;<a href='https://beian.miit.gov.cn/' target='_blank'>" + data[8].value + "</a>&nbsp;&nbsp;" + data[9].value + "营业执照" + "&nbsp;&nbsp;网站支持&nbsp;&nbsp;<span style='border:1px solid #eaeaea;padding:2px 3px;border-radius:3px;font-weight:bold'>IPV6</span>");
}
},
error: function (err) {
console.log(err);
}
});
}
getBasics();