(function ( w , d ) { var basics = { width : win.width(), height : win.height(), dir: 0, btnwidth : 180 }; var abguguo , timer; (function () { var abguguofr = $( '#abguguo .fr' ), abguguofrbtn = abguguofr.find( 'button' ), abguguofrli = abguguofr.find( 'li' ); var dir = 0, len = abguguofrli.length; abguguofrbtn.click( function () { dir += 1; dir %= len; abguguofrli.eq( dir ).stop().animate( { 'opacity' : 1 } , 500 ).siblings().stop().animate( { 'opacity' : 0 } , 500); abguguofr.attr( 'l-txt' , abguguofrli.eq( dir ).find( 'img' ).attr( 'alt' ) ); } ); var nub = $( '#abguguo .nub span' ) , nubs = [], nubd = []; for ( var i = 0 ; i < nub.length ; i++ ) { nubs[ i ] = number( nub.eq( i ).html() ); nubd[ i ] = 0; }; abguguo = function () { for ( var i = 0 ; i < nub.length ; i++ ) { nub[ i ].innerhtml = 0; nubd[ i ] = 0; }; clearinterval( timer ); timer = setinterval(function () { var flag = 0; for ( i = 0 ; i < nub.length ; i++ ) { if ( nubd[ i ] >= nubs[ i ] ) { nubd[ i ] = nubs[ i ]; nub.eq( i ).html( nubd[ i ] ); flag++; } else { dir = math.ceil( nubs[ i ] / 25 ); nubd[ i ] += dir; nub.eq( i ).html( nubd[ i ] ); }; }; if ( flag >= nub.length ) { clearinterval( timer ); for ( i = 0 ; i < nub.length ; i++ ) nub.eq( i ).html( nubs[ i ] ); } } , 70); }; }()); var aboutmain = $( '#aboutmain' ) , rolldiv = aboutmain.children( 'div' ), section = rolldiv.find( 'section' ) , aboutbtn = $( '#aboutbtn' ), aside = aboutbtn.find( 'aside' ), aboutbtndiv = aboutbtn.find( 'div' ), len = section.length - 1; var sectiontop = []; function init () { basics.dir = number( win.href().split('#').pop().length >= 5 ? 0 : win.href().split('#').pop() ); if ( basics.width >= 1024 ) { rolldiv.width( len * 100 + '%' ); section.width( 100 / len + '%' ); aside.width( basics.btnwidth * len + 'px' ); css( aboutbtn[ 0 ] ); ani ( basics.dir ); rolldiv.stop().animate({ 'scrolltop' : 0 } , 0); } else { rolldiv.width( '100%' ); section.width( '100%' ); aboutbtn.width( 0 ); scrollinit( basics.dir ); for ( var i = 0 ; i < len ; i++ ) { sectiontop[ i ] = section.eq( i )[ 0 ].getboundingclientrect().top; }; }; }; function start () { var wow = $( '.abwow' ); wow.css( { 'animation-name' : 'none' } ); };start (); function wowani ( n ) { var wow = section.eq( n ).find( '.abwow' ); wow.each( function () { var _this = $( this ); css( _this[ 0 ] , { 'animation' : _this.attr( 'l-ani-name' ) + ' 1.5s ' + _this.attr( 'l-ani-de' ) + 's' } ); settimeout(function () { css( _this[ 0 ] , { 'visibility' : 'visible' } ); } , _this.attr( 'l-ani-de' ) * 1000 + 100 ); } ); }; function fn ( n ) { if ( basics.width < 1024 ) return; w.location.href = '#' + n; if ( n == 0 ) { aside.addclass( 'act' ); aboutbtndiv.addclass( 'act' ); } else if ( n == 1 ) { abguguo(); aside.removeclass( 'act' ); aboutbtndiv.removeclass( 'act' ); } else { aside.removeclass( 'act' ); aboutbtndiv.removeclass( 'act' ); }; wowani ( n ); }; for (var i = 0; i < len; i++) { aside.append( '' ); }; var em = aside.find( 'em' ); em.click( function () { basics.dir = $( this ).index(); ani ( basics.dir ); } ); function ani ( n ) { aboutmain.stop().animate({ 'scrollleft' : n * basics.width + 'px' } , 600); aboutbtndiv.stop().animate({ 'scrollleft' : n * 175 + 'px' } , 600); css( aside[ 0 ] , { 'transform' : 'translatex( -' + n * (basics.btnwidth-20) + 'px )' } ); em.eq( n )[ 0 ].classname = 'act'; em.eq( n ).prevall().removeclass().addclass( 'prev' ); em.eq( n ).nextall().removeclass().addclass( 'next' ); fn.call( section.eq( n ) , n ); }; function scrollinit ( n ) { basics.dir = number( win.href().split('#').pop().length >= 5 ? 0 : win.href().split('#').pop() ); rolldiv.stop().animate({ 'scrolltop' : section[ n ].getboundingclientrect().top + 'px' } , 500); }; function scroll () { if ( basics.width >= 1024 ) return; section.each( function ( i ) { if ( ($( this )[ 0 ].getboundingclientrect().top + $( this )[ 0 ].getboundingclientrect().bottom >= basics.height * .6) && $( this )[ 0 ].getboundingclientrect().top >= 0 && $( this )[ 0 ].getboundingclientrect().top < basics.height ) { basics.dir = $( this ).index(); wowani ( basics.dir ); w.location.href = '#' + basics.dir; return false; }; } ); };scroll (); function up ( n ) { if ( basics.dir <= 0 ) return; basics.dir = n || basics.dir - 1; ani ( basics.dir ); }; function down ( n ) { if ( basics.dir+1 > len-1 ) return; basics.dir = n || basics.dir + 1; ani ( basics.dir ); }; if (d.addeventlistener) { d.body.addeventlistener('dommousescroll', function ( e ) { if ( aboutmain.is( ":animated" ) ) return; if ( e.wheeldelta > 0 ) up(); else down(); }, false); }; w.onmousewheel = d.body.onmousewheel = function ( e ) { if ( aboutmain.is( ":animated" ) ) return; if ( e.wheeldelta > 0 ) up(); else down(); }; events.add( w , 'touchmove' , scroll ); events.add( w , 'scroll' , scroll ); init (); events.add( w , 'resize' , function () { basics.width = win.width();init(); basics.height = win.height(); } ); ( function () { function setmap ( mapname , where , make ) { var map = new bmap.map( mapname ); var point = new bmap.point( where.split( ',' )[ 0 ] , where.split( ',' )[ 1 ] ); var marker = new bmap.marker( point ); map.centerandzoom( point , 11 ); map.addoverlay( marker ); map.addcontrol( new bmap.navigationcontrol () ); map.enablecontinuouszoom(); map.enablescrollwheelzoom(); var opts = { title : make }; var infowindow = new bmap.infowindow( '' , opts ); marker.openinfowindow( infowindow , map.getcenter () ); }; var map = d.getelementbyid( 'abmap' ); setmap ( 'abmap' , attr.add( map , 'l-center' )[ 0 ] , attr.add( map , 'l-maptxt' )[ 0 ] ); } )(); } ( window , document ));