// javascript document var data={ win_w:$(window).width(), win_h:$(window).height(), tpage:0, foot : $('footer'), choosepage:null, time_num:0, left_item:[], isani:false }; var page = { home : $('#index') }; var init=function(){ $("#search_btn").click(function(){ $('#search_form').submit(); }); $('.go-msg').on('click',function () { $('.msg-pop').addclass('on'); }); $('.popmask').on('click',function () { $('.msg-pop').removeclass('on'); }); initfn.nav(); var home_next = function(){ if( data.isani) return false; data.isani = true; var items = document.queryselectorall('.row'), itemscount = items.length; if(data.tpage == 0){ $('#component').attr('data-loop','false'); } if(data.tpage==(itemscount-1)){ data.foot.addclass('on'); data.tpage = (-1); settimeout(function () { data.isani = false; },800); }else if(data.tpage==(-1)){ settimeout(function () { data.isani = false; },100); } else{ _navigate( 'next' ,items,itemscount); } }; var home_prev =function(){ if( data.isani) return false; data.isani = true; var items = document.queryselectorall('.row'), itemscount = items.length; if(data.tpage==1){ $('#component').attr('data-loop','true'); } if(data.tpage>0){ _navigate( 'prev' ,items,itemscount); }else{ settimeout(function () { data.isani = false; },100); } if(data.tpage==(-1)){ data.foot.removeclass('on'); data.tpage = (itemscount-1); settimeout(function () { data.isani = false; },800); } }; if(page.home.length>0){ if(base.ispc){ $('#bloc').mousewheel(function(event) { if(event.deltay == -1){ home_next(); } else if(event.deltay == 1){ home_prev(); } }); } homefn.svg(); var el = $('.fn-tab'); initfn.tab(el); } }; $(document).ready(function(){ new alan.scrollanimate(); init(); if($('#tech').length>0){ techfn.myitem(); } if($('#contact').length>0){ contactfn.map(); } if($('#quality').length>0){ videofn.tab(); qualityfn.linemove(); } if($('#duty').length>0){ dutyfn.cv1(); dutyfn.roll(); settimeout(function () { var btm = $('#layer-item').height(); $('.roll-set').css('bottom',btm); },5); } if($('#honor').length>0){ honorfn.swiper(); honorfn.mybox(); } if($('#video').length>0){ videofn.medioplay(); videofn.tab(); } if($('#download').length>0){ videofn.tab(); } if($('#ad').length>0){ var num = 0, box = $('#featured-area'), list = box.find('li'), page = box.find('#tnum'), len = list.length-1; $('#s-prev').on('click',function () { num = num>0 ? num-1 : len; list.eq(num).click(); page.text('0'+(num+1)); }); $('#s-next').on('click',function () { num = num0){ profn.in(); } if($('#pro_detail').length>0){ detailfn.swiper(); detailfn.menu(); } if($('#history').length>0){ historyfn.event(); } if($('#partner').length>0){ partnerfn.svg(); } if($('#job').length>0){ jobfn.go(); } if($('#index').length>0){ $('#component').find('.itemwrap').find('li').eq(0).removeclass('go'); var _l = $('#component').find('.tcon').find('.pagechange').find('li').length; console.log(_l); if(_l<=1){ $('#component').find('.tcon').find('.pagechange').hide(); } var _len = $('.webgl-slider').find('.img-list').length; var sum = (_len>5) ? 8 : 6; if(window.orientation==0){sum=3;} var myswiper = new swiper('#sw_1', { autoplay: false,//可选选项,自动滑动 loop:true, allowtouchmove: false, centeredslides : true, slidesperview :sum, parallax : (sum>=6), pagination: { el: '.swiper-pagination', clickable :true, }, on: { init: function(swiper){ var timer = false; $('#sw_1').find('.swiper-slide').on('click',function () { if(timer) return false; timer = true; var n = $(this).attr('data-swiper-slide-index'); var _n = $(this).index(); var m = 100; var cur = $(this).parent().find('.swiper-slide-active').index(); // $('#sw_1').find('.swiper-pagination').find('span').eq(_n)[0].click(); do{ if(m === 100){ m = _n - cur; if(m>0){ console.log(3); $('.pagination').find('.move-next')[0].click(); }else{ $('.pagination').find('.move-prev')[0].click(); } }else{ if(m>0){ myswiper.slidenext(); m--; }else{ myswiper.slideprev(); m++; } } }while (m!==0); settimeout(function () { timer = false; },1000); }); } }, }) } if($('#advantage').length>0){ adfn.swiper(); } if($('#ecology').length>0){ // ecologyfn.wave(); ecologyfn.fn2(); } $(document).on('click','.myclick',function () { var _this = $(this), is_timelist = _this.hasclass('time-list'), is_timeset = _this.hasclass('time-set'); if(is_timelist){ var n = _this.index(); historyfn.time(n); } if(is_timeset){ if(_this.hasclass('prev')){ var index = parseint($('.time-item').attr('data-num')); historyfn.time_set(index,0); } if(_this.hasclass('next')){ var index = parseint($('.time-item').attr('data-num')); $(this).removeclass('go'); historyfn.time_set(index,1); } } }); }); $(window).resize(function() { $('[data-hei]').each(function(){ var wid=$(this).width(), hei=parseint(wid*($(this).attr('data-hei'))); $(this).css('height',hei+"px"); }); }); var initfn = { nav:function () { var box = $('.pc-nav'), num = null, timer = null, timer1 = null child = $('.childnav'), _item = child.find('ul'), list = box.find('li'), down = box.find('.nav-down'); list.mouseenter(function () { if($(this).hasclass('nav-down')){ _item.eq(num).removeclass('go'); }else{ child.removeclass('on'); _item.removeclass('go'); } }); down.each(function (index,el) { var _this = $(this); var _left = $(this).offset().left; _item.eq(index).css('transform','translatex('+_left+'px)'); _this.mouseenter(function () { num = index; child.addclass('on'); _item.eq(index).addclass('go'); }); }); $('.wrapper').mouseenter(function () { child.removeclass('on'); _item.removeclass('go'); }); $('#icon-item').mouseenter(function () { child.removeclass('on'); _item.removeclass('go'); }); if(window.innerwidth<600){ $('.language').on('click',function () { $(this).find('.sub').toggle(); }); $('.net').on('click',function () { $(this).find('.sub').toggle(); }); } }, tab : function (item) { var have = item.length>0 ? false : true; if(have) return false; var box = function (opts) { var _tab = opts._item, _bg = opts.bg, _li = opts._list; var _tab_child = _tab.children(), _li_child = _li.children(); _tab_child.mouseenter(function () { var index = $(this).index(); $(this).addclass('on').siblings().removeclass('on'); _li_child.eq(index).addclass('on').siblings().removeclass('on'); _bg.eq(index).addclass('on').siblings().removeclass('on'); }); }; item.each(function () { var _this = $(this), bg = $('.r-bg2'), list = $('#'+_this.attr('data-tab')); new box ({ _item:_this, bg:bg, _list:list }); }); } }; var adfn = { swiper : function () { var loop = function (opts) { var parent = opts.parent, prev = parent.find('.f-prev'), next = parent.find('.f-next'), box = parent.find('.roll-box'), item = box.find('.swiper-item'), cur = 0, all = 5, isani = false, list = item.find('li'), wid = list.eq(0)[0].clientwidth+2, length = list.length - 1; if(base.ispc){ wid = wid + 16; }else{ wid = wid + 8; } if(window.innerwidth<=1366){ all = 4; } var _all = (wid)*all; parent.css('width', _all+'px'); prev.on('click',function () { swiper_go(cur,'prev'); }); next.on('click',function () { swiper_go(cur,'next'); }); function swiper_go(index,type) { if(isani) return false; isani = true; var left = 0; if(type == 'prev'){ var cur_list = item.find('li').eq(length); cur = index>0 ? (index-1) : length; item.css("left",-wid); item.prepend(cur_list); item.animate({ left:0 },350); } if(type == 'next'){ var cur_list = list.eq(cur); cur = index 0 ? (index-1) : 0; _item.css('transform','translatex(-'+(rang*num)+'%)'); _item.attr('data-num',num); } data.time_num = data.time_num > 0 ? (data.time_num-1) : 0; historyfn.time(data.time_num); } if(type==1){ var item = $('.time-item'), len = item.find('li').length; if(data.time_num>6){ if(data.win_w<700){ var num = index < len-5 ? (index+1) : len-5; }else{ var num = index < len-8 ? (index+1) : len-8; } _item.css('transform','translatex(-'+(rang*num)+'%)'); _item.attr('data-num',num); } data.time_num = data.time_num < len-1 ? (data.time_num+1) : len-1; historyfn.time(data.time_num); } } }; var partnerfn = { svg : function () { var box = $('#svg-box'), dot1 = box.find('.dot1'), dot2 = box.find('.dot2'), dot3 = box.find('.dot3'), an = box.length; box.each(function (index) { var _this = $(this), r = (_this.width()*0.84)/2 - 1; var shape1 = new mojs.shape({ parent: _this[0], shape: 'circle', radius: r, angle: -70, fill: 'rgba(255,255,255,0)', stroke: '#03aedb', strokedasharray: '100%', strokedashoffset: { '-100%' : '0%' }, strokewidth: 3, isshowstart: true, repeat: 0, delay:500, duration: 5000, easing: 'cubic.out', onupdate:function (progress) { if(progress>0.68){ dot1.addclass('on'); $('.g1').addclass('on'); } if(progress>0.82){ dot2.addclass('on'); $('.g2').addclass('on'); } if(progress>0.94){ dot3.addclass('on'); $('.g3').addclass('on'); } } }).play(); }); } }; var profn = { in:function () { console.log(1); var line = $('#line-box'); var msg = $('.msg'); var menu = $('.menu'); settimeout(function () { line.addclass('on'); },1800); settimeout(function () { msg.addclass('on'); },3600); settimeout(function () { menu.addclass('on'); },4200); } }; var detailfn ={ swiper : function () { var loop = function (opts) { var parent = opts.parent, prev = parent.find('.f-prev'), next = parent.find('.f-next'), box = parent.find('.roll-box'), item = box.find('.swiper-item'), cur = 0, isani = false, list = item.find('li'), wid = list.eq(0)[0].clientwidth+2, length = list.length - 1; if(base.ispc){ wid = wid + 16; }else{ wid = wid + 8; } prev.on('click',function () { swiper_go(cur,'prev'); }); next.on('click',function () { swiper_go(cur,'next'); }); function swiper_go(index,type) { if(isani) return false; isani = true; var left = 0; if(type == 'prev'){ var cur_list = item.find('li').eq(length); if(cur_list.attr('data-roll')0 ? (index-1) : length; item.css("left",-wid); item.prepend(cur_list); item.animate({ left:0 },350); } } if(type == 'next'){ var cur_list = list.eq(cur); if(cur_list.attr('data-roll')<=0){ cur = index0 ? (index-1) : length; } if(type == 'next'){ cur = index0 ? (index-1) : length; item.css("left",-wid); item.prepend(cur_list); item.animate({ left:0 },450); } if(type == 'next'){ var cur_list = list.eq(cur); cur = index0 ? cur-1 : 0; page.text(cur+1); _item.find('.mylist').eq(cur).addclass('on').siblings().removeclass('on'); _this.addclass('on'); settimeout(function () { _this.removeclass('on'); },300); }) } }; var homefn = { svg : function () { var box = $('#r2 .rowmain .cir-box'), an = box.length; box.each(function (index) { var _this = $(this), offset = (an-index)*(60/an), r = _this.width()/2, r2 = _this.width()/2 - 40; var shape1 = new mojs.shape({ parent: _this[0], shape: 'circle', radius: r, fill: 'rgba(255,255,255,0)', stroke: 'rgba(255,255,255,0.8)', angle: -70, scale:{1.1:1}, strokedasharray: '100%', strokedashoffset: { '100%' : (offset)+'%' }, strokewidth: 2, isshowstart: true, repeat: 0, delay:500, duration: 1500, easing: 'cubic.out', }).play(); var shape2 = new mojs.shape({ parent: _this[0], shape: 'circle', radius: r2, fill: 'rgba(255,255,255,0)', stroke: '#00a6d2', angle: -90, scale:{1.1:1}, strokedasharray: '100%', strokedashoffset: { '100%' : (offset+5)+'%' }, strokewidth: 30, isshowstart: true, repeat: 0, duration: 2000, easing: 'cubic.out', }).play(); $('.fn-tab').find('li').eq(index).on('mouseenter',function () { shape1.replay(); shape2.replay(); }); }); } }; var techfn = { myitem :function () { var box = $('#tech-item'), msg = box.find('.msg').find('li'), pic = box.find('.photo').find('.pic'); msg.on('mouseenter',function () { var _this = $(this), index = _this.index(); _this.addclass('on').siblings().removeclass('on'); pic.eq(index).addclass('on').siblings().removeclass('on'); }); } }; var qualityfn = { linemove :function () { var box = $('#line-box'), cur = (7), index = 2, list = box.find('li'), line = box.find('.line'); list.on('mouseenter',function () { var _this = $(this), num = _this.index(); var x = ((index-num)*18)+cur; _this.addclass('on').siblings().removeclass('on'); line.css('transform','translatex('+(-x)+'%)'); }); } }; var videofn = { medioplay : function () { var _video = function (opts) { var dialog = opts.box, video = dialog.find('video'), el = opts.el, url = el.attr('data-url'); el.on('click',function () { video.attr('src',url); video[0].load(); video[0].play(); }); }; $('[data-dialog]').each(function () { var _this = $(this); new _video({ box : $('#medio_dialog'), el : _this }); }); }, tab:function () { $('[data-tab]').each(function () { var _this = $(this); _this.on('click',function () { _this.addclass('on').siblings().removeclass('on'); var _tab = _this.attr('data-tab'); $('#'+_tab).addclass('on').siblings().removeclass('on'); }); }); } }; var contactfn = { map : function () { var top_right_navigation = new bmap.navigationcontrol({anchor: bmap_anchor_top_right, type: bmap_navigation_control_small}); //右上角,仅包含平移和缩放按钮 var map = new bmap.map("tmap"); map.addcontrol(top_right_navigation); //添加标注点1 var pt1 = new bmap.point(118.111747,24.604343); var myicon1 = new bmap.icon("/templates/dist/img/map-dot1.png", new bmap.size(70,49)); var marker1 = new bmap.marker(pt1,{icon:myicon1}); // 创建标注 //添加覆盖物 function add_overlay(){ if(base.ispc){ map.centerandzoom(new bmap.point((118.111747+0.001),24.604343),20); }else{ map.centerandzoom(new bmap.point(118.111747,(24.604343+0.0005)),20); } map.addoverlay(marker1);// 将标注添加到地图中 marker1.setanimation(bmap_animation_bounce); } add_overlay(); map.setmapstyle({ stylejson:[ { "featuretype": "all", "elementtype": "geometry", "stylers": { "hue": "#007fff", "saturation": 89 } }, { "featuretype": "land", "elementtype": "all", "stylers": { "color": "#ffffff", "lightness": 100 } } ] }); //创建检索信息窗口对象 var content = '
' + '' + '地址:福建省厦门市集美北区天凤路69号
电话:86-592-615-1888
' + '
'; var searchinfowindow = null; searchinfowindow = new bmaplib.searchinfowindow(map, content, { title : "建霖工业有限公司", //标题 width : 290, //宽度 height : 160, //高度 panel : "panel", //检索结果面板 enableautopan : true, //自动平移 searchtypes :[ bmaplib_tab_search, //周边检索 bmaplib_tab_to_here, //到这里去 bmaplib_tab_from_here //从这里出发 ] }); marker1.addeventlistener("click", function(e){ searchinfowindow.open(marker1); }); } }; var jobfn ={ go :function () { var box = $('#r2'), isani = false, cur = 0, icon = box.find('.icon-item').find('li'), msg = box.find('.msg'), page = box.find('.page'), prev = box.find('.p-prev'), next = box.find('.p-next'), pic = box.find('.pic'); var items = document.queryselectorall('.bg'), itemscount = items.length; prev.on('click',function () { if(data.isani) return false; swiper_go(cur,'prev'); }); next.on('click',function () { if(data.isani) return false; swiper_go(cur,'next'); }); function swiper_go(index,type) { if(isani) return false; isani = true; if(type == 'prev'){ cur = index>0 ? (index-1) : (itemscount-1); _navigate( 'prev' ,items,itemscount); } if(type == 'next'){ cur = index<(itemscount-1) ? (index+1) : 0; _navigate( 'next' ,items,itemscount); } if(type == 'num'){ cur = index; } page.text('0'+(cur+1)); // item.css('transform','translatex(-'+left+'px)'); msg.eq(cur).addclass('on').siblings('.msg').removeclass('on'); icon.eq(cur).addclass('on').siblings().removeclass('on'); settimeout(function () { isani = false; },600); } } }; var ecologyfn={ wave:function(){ const el = document.getelementbyid('wave'); const ctx = el.getcontext('2d'); const dpr = window.devicepixelratio || 1; const pi = math.pi; const points = 4; const radius = 0.18*window.innerwidth*dpr;//流体范围 const h = 0.3*window.innerwidth*dpr; const w = 0.3*window.innerwidth*dpr; const center = { x: w/2*dpr, y: h/2*dpr }; const circle=[]; const rangemin =1; const rangemax = 5; const showpoints = false;//是否显示点 var mousey = 200; var tick = 0; const gradient1 = ctx.createlineargradient(0,0,w,0); gradient1.addcolorstop(0,'rgba(255,255,255,0.6)'); gradient1.addcolorstop(1,'rgba(255,255,255,0.5)'); const gradient2 = ctx.createlineargradient(0, 0, w, 0); gradient2.addcolorstop(0, 'rgba(255,255,255,0.6)'); gradient2.addcolorstop(1, 'rgba(255,255,255,0.5)'); const gradient3 = ctx.createlineargradient(0, 0, w, 0); gradient3.addcolorstop(0, 'rgba(255,255,255,0.6)'); gradient3.addcolorstop(1, 'rgba(255,255,255,0.5)'); const gradient4 = ctx.createlineargradient(0, 0, w, 0); gradient4.addcolorstop(0, 'rgba(255,255,255,0.6)'); gradient4.addcolorstop(1, 'rgba(255,255,255,0.5)'); const gradient = [gradient1,gradient2,gradient3]; window.addeventlistener('mousemove',handlemove,true); function handlemove (event) { mousey = event.clienty; } ctx.scale(dpr,dpr); el.width = w*dpr; el.height = h*dpr; el.style.width =w + 'px'; el.style.height = h +'px'; for(var idx =0 ;idx<=gradient.length;idx++){ var swingpoints = [];//流体点 var radian = 0; for(var i = 0;i= _abs) { str.x = -(_arr[_len - index].x - 68); str.y = (_arr[_len - index].y); } else { str.x = _r * math.cos((40 * index) / 360 * math.pi - (math.pi/2)) + (68/2); str.y = -(_r * math.sin((40 * index) / 360 * math.pi - (math.pi/2)) - (68/2)); } }else{ if (index >= _abs) { str.x = _arr[_len - index].x; str.y = -(_arr[_len - index].y - (0.078*window.innerwidth)); } else { str.x = _r * math.cos((_radin * index) / 360 * math.pi) + (0.078*window.innerwidth/2); str.y = -(_r * math.sin((_radin * index) / 360 * math.pi) - (0.078*window.innerwidth/2)); } } _this.css({ 'left': -str.x + "px", 'top': -str.y + "px", 'opacity':'1' }); _arr.push(str); _this.on('click', function (e) { var index = $(this).parent().index(); swiper_go(index, 'num'); }); }); $('.pagination').find('[data-slide]').on('click',function () { var index = $(this).attr('data-slide'); swiper_go(index, 'num'); }) if(base.ispc){ $('#bloc').mousewheel(function(event) { if(event.deltay == -1){ if(isani) return false; swiper_go(_cur, 'next'); } else if(event.deltay == 1){ if(isani) return false; swiper_go(_cur, 'prev'); } }); }else{ function next_(){ swiper_go(_cur, 'next'); } function prev_(){ swiper_go(_cur, 'prev'); } base.touchmove($('#banner'),next_,prev_) } function swiper_go(index,type) { if(isani) return false; isani = true; if(type == 'prev'){ _cur = index>0 ? (index-1) : _len-1; $('.pagination').find('[data-slide]').eq(_cur)[0].click(); } if(type == 'next'){ _cur = index<_len-1 ? (index+1) : 0; $('.pagination').find('[data-slide]').eq(_cur)[0].click(); } if(type == 'num'){ _cur = index; $('.pagination').find('[data-slide]').eq(_cur)[0].click(); } reset(0); settimeout(function () { isani = false; },1200); }; function reset(n) { var m =100;var deg = 0; do{ var arr =[]; if(m == 100){ for(var k in _rang){ var that = _rang[k].x; if(_cur == that){ m = k - _half; deg = m; } } }else{ if(m>0){ for(var k in _rang){ var that = _rang[k].x; _rang[k].x = (that<_len-1 ? (that+1) : 0); } m--; }else{ for(var k in _rang){ var that = _rang[k].x; _rang[k].x=(that >0 ? (that -1) : _len-1); } m++; } } }while (m!=0); move_(_rang,deg); _list.eq(_cur).addclass('on').siblings().removeclass('on'); } function move_(arr,m) { for(var k in arr){ var _this = arr[k].x; var _curr = parseint(_list.eq(_this).attr('data-r')); var _deg = null; if(window.orientation==0){ _deg = _curr+(20*m); if(k>=arr.length-m&&m>0){ _deg = _curr+(20*m) + 260; _list.eq(_this).addclass('move').css('opacity','0'); }else if(k=arr.length-m&&m>0){ _deg = _curr+(15*m) + 285; _list.eq(_this).addclass('move').css('opacity','0'); }else if(k 0 ? data.tpage - 1 : itemscount - 1; } else if( dir === 'num' ){ data.tpage = data.choosepage; } console.log("当前"+data.tpage); if(data.tpage==0){ $('.partname').removeclass('gc'); $('header').removeclass('on'); }else{ $('.partname').addclass('gc'); $('header').addclass('on'); } $('.partname').find('.list').eq(data.tpage).addclass('on').siblings().removeclass('on'); var nextitem = items[ data.tpage ]; var onendanimationcurrentitem = function() { this.removeeventlistener( animendeventname, onendanimationcurrentitem ); classie.removeclass( this, 'on' ); classie.removeclass( this, dir === 'prev' ? 'navoutprev' : 'navoutnext' ); ++cntanims; if( cntanims === 2 ) { data.isani = false; } }; function a() { classie.removeclass( currentitem, 'on' ); classie.removeclass( currentitem, dir === 'prev' ? 'navoutprev' : 'navoutnext' ); ++cntanims; if( cntanims === 2 ) { settimeout(function () { data.isani = false; },200); } } function b() { classie.addclass( nextitem, 'on' ); classie.removeclass( nextitem, dir === 'prev' ? 'navinprev' : 'navinnext' ); ++cntanims; if( cntanims === 2 ) { settimeout(function () { data.isani = false; },200); } } var onendanimationnextitem = function() { this.removeeventlistener( animendeventname, onendanimationnextitem ); classie.addclass( this, 'on' ); classie.removeclass( this, dir === 'prev' ? 'navinprev' : 'navinnext' ); ++cntanims; if( cntanims === 2 ) { data.isani = false; } }; if( support.animations ) { classie.addclass( currentitem, dir === 'prev' ? 'navoutprev' : 'navoutnext' ); classie.addclass( nextitem, dir === 'prev' ? 'navinprev' : 'navinnext' ); settimeout(function () { a(); b(); },700); } else { console.log('不支持css3 animated'); $(currentitem).hide(); $(nextitem).fadein(200); settimeout(function(){ classie.removeclass( currentitem, 'on' ); classie.addclass( nextitem, 'on' ); data.isani = false; },200) } } /*dom分割*/ $.fn.forslide = function (_option) { _temp = ''; _html = ''; var _setting = { item: '.item', step: 4, tagname: 'li', tagclass: '', clear: false, attr: '', callback: function () { } } $.extend(_setting, _option); o = this; _size = o.find(_setting.item).length; if (_setting.clear) { _clear = '
'; } else { _clear = ''; } if (_size > _setting.step) { if (_size % _setting.step == 0) { for (_i = 0; _i < _size; _i++) { _temp += o.find(_setting.item + ':eq(' + _i + ')').prop('outerhtml'); if ((_i + 1) % _setting.step == 0) { _html += '<' + _setting.tagname + ' ' + _setting.attr + ' class="' + _setting.tagclass + '">' + _temp + _clear + ''; _temp = ''; } } } else { _page = math.floor(_size / _setting.step); for (_i = 0; _i < _size; _i++) { _temp += o.find(_setting.item + ':eq(' + _i + ')').prop('outerhtml'); if ((_i + 1) % _setting.step == 0 && _i + 1 <= _page * _setting.step) { _html += '<' + _setting.tagname + ' ' + _setting.attr + ' class="' + _setting.tagclass + '">' + _temp + _clear + ''; _temp = ''; } } _html += '<' + _setting.tagname + ' ' + _setting.attr + ' class="' + _setting.tagclass + '">' + _temp + _clear + ''; } } else { _html += '<' + _setting.tagname + ' ' + _setting.attr + ' class="' + _setting.tagclass + '">' + o.html() + ''; } o.empty().append(_html); _setting.callback(); }; // $(document).ready(function () { var screendirection = window.matchmedia("(orientation: portrait)"); screendirection.addlistener(handleorientationchange); handleorientationchange(screendirection); function handleorientationchange(screendirection) { if (screendirection.matches) { /* the device is currently in portrait orientation */ /* 竖屏处理事件 */ var sleft = $('.after-inner #top .other .tree > ul > li.on').position().left; $('.after-inner #top .other .tree').animate({ scrollleft:sleft }) } else { /* the device is currently in landscape orientation */ /* 横屏屏处理事件 */ } } });