$(document).ready(function() { // $('.pack .dec .sdec').hover(function() { // $(this).parent('.dec').addclass('click').siblings('.dec').addclass('small'); // $(this).parent('.dec').siblings().removeclass('click'); // }); if ($(window).width() < 640) { $('.banner .swiper-slide-bg').each(function(){ var url = $(this).css('background-image').replace('url(','').replace(')',''); $(this).append(''); }); } var controller = $.superscrollorama({ triggeratcenter: true, playoutanimations: true }); if ($(window).width() > 1024) { $('.pack .dec').hover(function() { $(this).stop().animate({'width': 500, 'height': 550}, 500, function(){ $(this).addclass('cur').siblings().removeclass('cur'); }); $(this).siblings().stop().animate({'width': '20%', 'height': 298}, 500); $(this).children('.transys').children('.sdec').stop().animate({ 'opacity': 0,'width': 500, 'height': 500},500); $(this).siblings().children('.transys').children('.sdec').stop().animate({'width': 247, 'height': 270, 'opacity': 1}, 500); $(this).find('h2').stop().animate({'right': 390}, 500); $(this).parents('.pack').stop().animate({'height': 550}, 500); $(this).find('.kuang').stop().animate({'opacity': 0}, 200); controller.addtween( '.positionbox', (new timelinelite()) .append([ tweenmax.fromto($('.positionboxtween'), 2, {css: {top: 0}, immediaterender: true}, {css: {top: 120}}) ]), 500 ); controller.addtween( '.aboutus .partners .dec', (new timelinelite()) .append([ tweenmax.fromto($('.aboutus .partners .dec .pic img'), 0.5, {css: {top: 0}, immediaterender: true}, {css: {top: -60}}) ]), 500 ); }, function() { if ($(window).width() < 1100) { $('.pack .dec').stop().animate({'width': '33%','height': 298}, 500, function(){ $(this).removeclass('cur'); }); } else{ $('.pack .dec').stop().animate({'width': 331,'height': 298}, 500, function(){ $(this).removeclass('cur'); }); } $('.pack .dec .sdec').stop().animate({ 'opacity': 1, 'width': 331, 'height': 270},500); $(this).find('h2').stop().animate({'right': -28}, 500); $(this).parents('.pack').stop().animate({'height': 298}, 500); $(this).find('.kuang').stop().animate({'opacity': 1}, 500); }); // for (var i = 0; i < $('.pack .dec').length; i++) // { // $('.pack .dec').eq(i).hover(function() { // $(this).stop().animate({'width': 500, 'height': 550}, 500); // $(this).siblings().stop().animate({'width': 247, 'height': 298}, 500); // $(this).children('.transys').children('.sdec').stop().animate({ 'opacity': 0,'width': 500, 'height': 500},500); // $(this).siblings().children('.transys').children('.sdec').stop().animate({'width': 247, 'height': 270, 'opacity': 1}, 500); // $(this).find('h2').stop().animate({'right': 390}, 500); // $(this).parents('.pack').stop().animate({'height': 550}, 500); // $(this).find('.kuang').stop().animate({'opacity': 0}, 200); // $(this).addclass('cur'); // console.log($(this).index()) // }, function() { // $('.pack .dec').eq(i).stop().animate({'width': 331,'height': 298}, 500, function(){ // $(this).removeclass('cur'); // }); // $('.pack .dec .sdec').stop().animate({ 'opacity': 1, 'width': 331, 'height': 270},500); // $(this).find('h2').stop().animate({'right': -28}, 500); // $(this).parents('.pack').stop().animate({'height': 298}, 500); // $(this).find('.kuang').stop().animate({'opacity': 1}, 500); // }); // } controller.addtween( '.foodsafety', tweenmax.from($('.foodsafety .item'), 0.5, {css: {width: 0, opacity: 0}} ),0,-200 ) controller.addtween( '.product ', tweenmax.from($('.chickenbgbox'), 1.5, {css: {transform: 'scale(1.1,1.1)', opacity: 0}} ),0,-100 ); controller.addtween( '.product ', tweenmax.to($('.chickenbg'), 1.5, {css: {height: 176}} ),0,200 ); controller.addtween( '.cont', tweenmax.from($('.map .mapbox .text'), 1, {css: {left: '-100%', opacity: 0}} ), 0, 100 ); controller.addtween( '.cont', tweenmax.from($('.map .mapbox .text h4'), 1, {delay: 0.2, css: {left: '-100%', opacity: 0}} ), 0, 100 ); controller.addtween( '.cont', tweenmax.from($('.map .mapbox .text p'), 1, {delay: 0.8, css: {left: '-100%', opacity: 0}} ), 0, 100 ); } if ($(window).width() < 1024) { $('.pack .dec .sdec').click(function() { $(this).parents('.dec').addclass('click').siblings('.dec').addclass('small'); $(this).parents('.dec').siblings().removeclass('click'); }); } $('.pack .dec .close').click(function(event) { $('.pack .dec').removeclass('click small'); }); // var time = null; // var key = 0; // time = setinterval(function(){ // key ++; // if (key >= $('.banner .swiper-slide').length) // { // key = 0; // } // $('.banner .swiper-slide').eq(key).fadein(500).siblings().fadeout(500); // }, 7800); // $('.news .transy').each(function(index,el) { // $(this).css({"transition":"700ms "+(index*200+300)+"ms"}); // }); // $('.map .transy').each(function(index,el) { // $(this).css({"transition":"700ms "+(index*200+300)+"ms"}); // }); if ($(window).width() < 1025) { $('.newsandmap .map .transy').addclass('transhow'); } $(window).scroll(function(event) { var st = $(window).scrolltop(); var w_height = $(window).height(); // if (st > $('.newsandmap').offset().top - w_height * 0.5) // { // $('.newsandmap .transy').addclass('transhow'); // } if ($('.productregion .modulartitle').length != 0) { if (st > $('.productregion .modulartitle').offset().top - w_height * 0.5) { $('.productregion .modulartitle .transy').addclass('transhow'); } if (st > $('.productlist .pic').offset().top - w_height * 0.5) { $('.productlist .transy,.productmove.transy').addclass('transhow'); } if (st > $('.foodsafetyregion').offset().top - w_height * 0.5) { $('.foodsafetyregion .transy').addclass('transhow'); } } }); $('.menu-handler').click(function(){ $(this).toggleclass('active'); $('.masknav').fadetoggle(); if ($(this).hasclass('active')) { $('nav').animate({'right' : 0} , 300); $('body,html').css({'height': '100%', 'overflow': 'hidden'}); } else{ $('nav').animate({'right' : -100+'%'} , 300); $('body,html').css({'height': 'auto', 'overflow': 'visible'}); } }); $('.masknav').mousedown(function(event) { $('nav').animate({'right' : -100+'%'} , 300); $('.menu-handler').removeclass('active'); $(this).hide(); $('body,html').css({'height': 'auto', 'overflow': 'visible'}); }); // controller.addtween( // '#news', // tweenmax.from($('#news'), 2, // { // css:{ // top: 300}, // oncomplete: function(){ // alert(1); // })); // controller.addtween( // '#news', // tweenmax.from($('#news'), 1, // {css:{top: 300}, oncomplete: function(){ // // controller.pin($('#news'),2000,{ // // anim: (new timelinelite()).append(tweenmax.fromto($('#news'), 2, // // {css: {top: -100}, immediaterender: true}, // // {css: {top: -500}} // // )) // // }) // var s1t = $(window).scrolltop(); // var ch = $('.cont').height(); // $(window).scroll(function(event) { // var st = $(window).scrolltop(); // if (st - s1t > 0 && st - s1t < $(window).height()) // { // $('.cont').css({'top': -(st - s1t)}); // }else { // $('.cont').css({'height': ch - (st - s1t)}); // console.log('到底了') // } // }); // }} // ), 0, -500 // ); if ($(window).width() > 860) { controller.addtween( '.cont', (new timelinelite()) .append([ tweenmax.fromto($('.contbox'), 1, {css: {top: 0}, immediaterender: true}, {css: {top: -150}}) ]), 500 ); } // controller.addtween( // '.server-box', // tweenmax.from($('article .server-box ul li'), 1.5, // {css:{height:0}} // ), 0, -300 // ); controller.addtween( '.cont', tweenmax.to($('.map .mapbox .maplogo'), 1, {css: {transform: 'scale(1)', opacity: 1}, ease: back.easeout, oncomplete: function(){ $('.mapspot,.mapline').addclass('cur'); }} ), 0, -300 ); controller.addtween( '.product .modulartitle', tweenmax.from($('.product .modulartitlebox'), 0.5, {css: {top: 30, opacity: 0}} ),0, -300 ); $('.retailers a').each(function(index, el) { var index = $(this).index(); }); for(var i = 0; i < $('.retailers a').length; i++) { console.log(i) controller.addtween( '.product', tweenmax.from($('.retailers a').eq(i), 0.3, {delay: i * 0.5, css:{top: 50, opacity: 0}, ease: back.easeout} ),0,0 ); } for(var i = 0; i< $('.productlist .dec').length; i++) { controller.addtween( '.productlist', tweenmax.from($('.productlist .dec').eq(i).find('h4'), 0.5, {delay: i * 0.2, css:{top: -10, opacity: 0}} ),0,-200 ); controller.addtween( '.productlist', tweenmax.from($('.productlist .dec').eq(i).find('p'), 0.5, {delay: i * 0.2, css:{left: 20, opacity: 0}} ),0,-200 ); controller.addtween( '.productlist', tweenmax.from($('.productlist .dec').eq(i).find('a'), 0.2, {delay: i * 0.2, css:{ opacity: 0}} ),0,-200 ); controller.addtween( '.productlist', tweenmax.from($('.productlist .dec').eq(i).find('.pic').find('img'), 0.7, {delay: i * 0.2, css:{transform: 'scale(0.8,0.8)', opacity: 0}, ease: back.easeout} ),0,-200 ); } controller.addtween( '.foodsafety', tweenmax.from($('.foodsafety .modulartitlebox'), 0.5, {css: {top: 30, opacity: 0}} ),0,-300 ); controller.addtween( '.foodsafety', tweenmax.from($('.foodsafety .item .icon'), 0.5, {delay: 0.5, css: {transform: 'scale(1.2,1.2)', opacity: 0}} ),0,100 ); controller.addtween( '.foodsafety', tweenmax.from($('.foodsafety .item .slogan'), 0.5, {delay: 0.3, css: {transform: 'scale(1.2,1.2)', opacity: 0}, oncomplete: function(){ for (var i = 0; i < $('.pack .dec').length; i++) { // controller.addtween( // '.foodsafety', // ); tweenmax.to($('.foodsafety .item .dec').eq(i), 0.5, {delay: i * 0.3, css: {top: 0, opacity: 1}} ) } }} ),0,100 ); /* * 凤祥资讯 */ var setnum = 160; var loadingnews = { pnode : $(document), page : 0, hasnextpage : true, // 加载更多新闻 fun: function(act){ var that = this; that.page = parseint(that.pnode.attr('page')); $(window).scroll(function () { var scrolltop = $(this).scrolltop(); var scrollheight = $(document).height() - 100; var windowheight = $(this).height(); var result = ''; if (scrolltop + windowheight >= scrollheight) { //此处是滚动条到底部时候触发的事件,在这里写要加载的数据,或者是拉动滚动条的操作 if (that.hasnextpage) { $('.loadingtext>p').text('正在努力加载中...'); $.get('', {'p': ++that.page}, function (res) { var data = res['data']; if (that.page <= res['page']['pagecount']) { switch (act){ case 'news': var detailurl = that.pnode.attr('detail-url'); detailurl = detailurl.replace('%p%', that.page); for (var i = 0; i < data.length; i++) { result += '
' + data[i]['date_arr'][0] + '' + data[i]['date_arr'][1] + '' + data[i]['date_arr'][2] + '

' + data[i].describe + '

'; } break; case 'honor': var static_url = that.pnode.attr('static'); for (var i = 0; i < data.length; i++) { if (data[i].classification == 1){ var cla = 'honor_s'; }else{ var cla = 'honor_g'; } result += '
'+ '
'+ '
'+ '

'+data[i].describe+'

'+ ''+ '

'+data[i].bureau+'

'+ '

'+data[i].date_arr[0]+'.'+data[i].date_arr[1]+'.'+data[i].date_arr[2]+'

'+ ''+ '
'+ '
'+ '
' } break; case 'history': for (var i = 0; i < data.length; i++) { if (data[i].is_big == 1){ var big = ' big'; }else{ var big = ''; } result += '
\n' + '
\n' + '
\n' + '
\n' + ''+data[i].date_arr[0]+'\n' + ''+data[i].date_arr[1]+'月'+data[i].date_arr[2]+'日\n' + '
\n' + '
\n' + '
\n' + '
\n' + '
\n' + '
\n' + '\n' + '
\n' + '
\n' + '

'+data[i].describe+'

\n' + '
\n' + '
\n' + '
\n' + '
'; } break; case 'join': for (var i = 0; i < data.length; i++) { result += '
'; for (var j = 0; j < data[i].length; j++) { result += '
\n' + '
\n' + '

' + data[i][j].job + '

\n' + '我要应聘\n' + '
\n' + '
\n' + '

部门:' + data[i][j].department + '

\n' + '

招聘人数:' + data[i][j].amount + '

\n' + '

学历要求:' + data[i][j].diploma + '

\n' + '
\n' + '
\n' + '

任职要求:

\n' + '' + data[i][j].content + '\n' + '
\n' + '
'; } result += '
'; } break; } that.pnode.append(result); } if (that.page+1 > res['page']['pagecount']){ $('.loadingtext>p').text('别拉了,我也是有底线的!'); that.hasnextpage = false; }else { $('.loadingtext>p').text('向下滑动查看更多...'); } }) } } }); } }; for (var i = 0; i< $('.historypage .list .dec').length; i ++) { if (i < 5) { $('.historypage .list .dec').eq(i).show(); } } // 加载更多新闻 /*var loadinghistory = { isbool : true, num: 5, fun: function(){ var that = this; $(window).scroll(function () {     var scrolltop = $(this).scrolltop();     var scrollheight = $(document).height();     var windowheight = $(this).height(); var result = '';     if (scrolltop + windowheight == scrollheight && that.isbool == true) { that.num = that.num + 5; that.isbool = false; $('.loadingtext p').text('正在努力加载中...'); settimeout(function(){ for (var i = 0; i< $('.historypage .list .dec').length; i ++) { if (i < that.num) { $('.historypage .list .dec').eq(i).show(0); $('.loadingtext p').text('向下滑动查看更多'); } if (that.num > $('.historypage .list .dec').length) { $('.loadingtext p').text('已经全部加载完成'); } } that.isbool = true; }, 500);     } }); } };*/ resizefun(); $(window).resize(function(event) { resizefun(); }); function resizefun(){ if ($(window).width() < 1300) { setnum = 100; } if ($(window).width() < 860) { setnum = 60; } if ($(window).width() < 450) { setnum = 32; } } if ($('.insidecont').has('.newslist').length == 1) { loadingnews.pnode = $('.newslist'); loadingnews.fun('news'); }else if ($('.insidecont').has('.honorlist').length == 1){ loadingnews.pnode = $('.honorlist'); loadingnews.fun('honor'); }else if ($('.insidecont').has('.historypage').length == 1){ loadingnews.pnode = $('.historypage .list'); loadingnews.fun('history'); }else if ($('.insidecont').has('.join1page').length == 1){ loadingnews.pnode = $('.join1page .list'); loadingnews.fun('join'); } textlimitnumber(); function textlimitnumber(){ for (var i = 0; i < $('.newslist .dec').length; i++) { limitnumber($('.newslist .dec:eq('+ i +') .text .info').find('p').text(), $('.newslist .dec:eq('+ i +') .text .info').find('p'), setnum); } } function limitnumber(txt,idname, num) { var str = txt; if (str.length > num) { str = str.substr(0,num) + '...' ; } idname.text(str); } /** * 凤祥愿景 */ vision(); function vision(){ var anim = $(".anim"); settimeout(function(){ $(window).scroll(function() { roll(); }); $(window).resize(function() { roll(); website(); }); roll(); },6); function roll() { var oheight = $(window).height(); var scrval = $(window).scrolltop(); anim.each(function(i) { if (scrval + oheight > anim.eq(i).offset().top + 50 ){ anim.eq(i).addclass("anim-show"); } }) }; $('.visionlist .dec').each(function(i) { controller.addtween( $('.visionlist .dec').eq(i), (new timelinelite()) .append([ tweenmax.fromto($('.visionlist .dec:eq('+ i +') .popover .popovertwwen'), 1, {css: {bottom: 0}, immediaterender: true}, {css: {bottom: 50}}) ]), 500 ); }) } /* *联系我们 */ controller.addtween( '.contactpage', (new timelinelite()) .append([ tweenmax.fromto($('.contactpage .popovertwwen'), 1, {css: {top: 0}, immediaterender: true}, {css: {top: -50}}) ]), 500 ); controller.addtween( '.safetychainpage .top', (new timelinelite()) .append([ tweenmax.fromto($('.safetychainpage .top .popovertwwen'), 1.5, {css: {bottom: -105}, immediaterender: true}, {css: {bottom: 0}}) ]), 500 ); /* *公司简介 */ if ($(window).width() <= 640 ) { for (var i = 0; i < $('nav ul li').length; i++) { if ($('nav ul li').eq(i).find('.naviphone').length > 0) { $('nav ul li').eq(i).find('.table a').attr({"href": 'javascript:;'}); } if ($('nav ul li').eq(i).find('.naviphone a').hasclass('cur')) { $('nav ul li').eq(i).find('.naviphone').css('display', 'block'); } } $('nav ul li').click(function(event) { $(this).addclass('cur').siblings('').removeclass('cur'); }); $('nav ul li .table a').click(function(event) { $(this).parents('.table').siblings('.naviphone').stop().slidetoggle().parents('li').siblings().find('.naviphone').stop().slideup(); }); }else{ controller.addtween( '.citizenpage .module1', (new timelinelite()) .append([ tweenmax.fromto($('.citizenpage .module1 .infoboxtween'), 1.5, {css: {top: -80}, immediaterender: true}, {css: {top: -0}}) ]), 500 ); controller.addtween( '.citizenpage .module2', (new timelinelite()) .append([ tweenmax.fromto($('.citizenpage .module2 .infoboxtween'), 1.5, {css: {bottom: '-10%'}, immediaterender: true}, {css: {bottom: '-25%'}}) ]), 500 ); controller.addtween( '.citizenpage .module3', (new timelinelite()) .append([ tweenmax.fromto($('.citizenpage .module3 .infoboxtween'), 1.5, {css: {bottom: '-10%'}, immediaterender: true}, {css: {bottom: '-40%'}}) ]), 500 ); controller.addtween( '.mod1 .module3', (new timelinelite()) .append([ tweenmax.fromto($('.citizenpage .module3 .infoboxtween'), 1.5, {css: {bottom: '-10%'}, immediaterender: true}, {css: {bottom: '-40%'}}) ]), 500 ); } $('.video_btn').click(function(event) { $('.videomask').show(); $(this).hide(); $('#video')[0].play(); }); $('.videomask .videomaskbg,.videomask .close').click(function(event) { $('.videomask').hide(); $('.video_btn').show(); $('#video')[0].pause(); }); $('.joinbtn').click(function(event) { $('.contactpop .contact').text($(this).attr('contact')); $('.contactpop .tel').attr('href','to:'+$(this).attr('tel')); $('.contactpop .tel').text($(this).attr('tel')); $('.contactpop .mobile').attr('href','to:'+$(this).attr('mobile')); $('.contactpop .mobile').text($(this).attr('mobile')); $('.contactpop .email').attr('href','mailto:'+$(this).attr('email')); $('.contactpop .email').text($(this).attr('email')); $('.contactpop').fadein(); $('.contactpop .dec .dectop i').click(function(event) { $('.contactpop').fadeout(); }); }); }); website(); // $('.websitebanner').css('height', $('.websitebanner img').height() - 80); function website(){ // if($(window).width() > 1600 ) // { // $('.websitebanner').css('height', $('.websitebanner').height()); // } //$('.websitebanner').css('height', $('.websitebanner img').height() - 60); if ($(window).width() >= 1300) { $('.websitebanner').css({'background': 'url('+ $('source').eq(0).attr('srcset') +') center 0 no-repeat', 'backgroundattachment' : 'fixed', 'backgroundsize': '100%'}); } else if($(window).width() >= 1024) { $('.websitebanner').css({'background': 'url('+ $('source').eq(1).attr('srcset') +') center 0 no-repeat', 'backgroundattachment' : 'fixed', 'backgroundsize': '100%'}); } else if ($(window).width() >= 320) { $('.websitebanner').css({'background': 'url('+ $('source').eq(2).attr('srcset') +') center 0 no-repeat', 'backgroundattachment' : 'fixed', 'backgroundsize': '100%'}); } }