/*根据屏幕适配font-size*/ /*;(function (doc, win) { var docel = doc.documentelement, resizeevt = 'onorientationchange' in window ? 'onorientationchange' : 'resize', recalc = function () { var clientwidth = docel.clientwidth; if (!clientwidth) return; if(clientwidth>=750){ docel.style.fontsize = '100px';//屏幕大于750,font-size:100px; }else{ docel.style.fontsize = 100 * (clientwidth / 750) + 'px'; } }; if (!doc.addeventlistener) return; win.addeventlistener(resizeevt, recalc, false); doc.addeventlistener('domcontentloaded', recalc, false); })(document, window);*/ ;(function($, window, document,undefined) { var tfn = function($,doc) { this.header = $('#header'), this.center = $('#wrapper'), this.footer = $('#footer'), this.windowwidth = ('innerwidth' in window) ? window.innerwidth : document.documentelement.clientwidth,//屏幕宽度 this.windowheight = ('innerheight' in window) ? window.innerheight : document.documentelement.clientheight,//屏幕高度 this.ienum = parseint(navigator.appversion.split(";")[1].replace(/[ ]/g, "").replace("msie",""));//如果是ie浏览器,ie的版本数 this.isanimating = false,//判断动画是否进行中 this.isanimating1 = false,//判断下拉动画是否进行中 this.anitime = 600, //动画时间 this.support = { animations : modernizr.cssanimations },//是否支持1,animations this.animendeventnames = { 'webkitanimation' : 'webkitanimationend', 'oanimation' : 'oanimationend', 'msanimation' : 'msanimationend', 'animation' : 'animationend' }, this.onendanimation = function( el, callback ) {//动画所属元素,如果不支持animations回调函数。 var onendcallbackfn = function( ev ) { if( this.support.animations ) { if( ev.target != this ) return; this.removeeventlistener( this.animendeventnames, onendcallbackfn ); } if( callback && typeof callback === 'function' ) { callback.call(); } }; if( this.support.animations ) { el.addeventlistener( this.animendeventnames, onendcallbackfn ); } else { onendcallbackfn(); } }, this.init(); /*var transendeventnames = { 'webkittransition' : 'webkittransitionend', 'moztransition' : 'transitionend', 'otransition' : 'otransitionend', 'mstransition' : 'mstransitionend', 'transition' : 'transitionend' }, this.transendeventname = transendeventnames[ modernizr.prefixed('transition') ]; //transition结束事件*/ } tfn.prototype = { //初始化 init : function() { if (!!window.activexobject || "activexobject" in window){$('body').addclass("ie");} if(this.ienum<9){ alert("您的浏览器版本过低,请下载ie9及以上版本");return false; }else if(this.ienum==9){ $('body').addclass("ie9"); }else if(this.ienum==10){ $('body').addclass("ie10"); }else if(this.ienum==11){ $('body').addclass("ie11"); } this.contentinit(); this.dialog(); this.appnav(); this.downmove(); }, //内容层min-height contentinit:function(){ var self = this, minheight =self.windowheight - (self.header.height() + self.footer.height()); self.center.css('min-height',minheight+'px'); }, //下拉动画 downmove:function(){ var self = this, downbox = $('.layout-down'), ishave = downbox.length<=0 ? true : false; if(ishave) return false; if(self.isanimating) return false; var isopen = function(){ console.log("下拉"); },//下拉时回调函数 isclose = function(){ console.log("未下拉"); };//未下拉时回调函数 var isactive = false; downbox.on('click',function(e){ self.isanimating = true; var isani = $(this).hasclass('father'), txtbox = $(this).find('.downtxt'), tdown = $(this).parents('.layout-down'), down = $(this).find('ul'), downli = down.find('li'), showani = down.attr('data-effect')||'fadeindown', hideani = down.attr('data-hideani')||'fadeoutdown'; isactive = $(this).attr('data-on')|| false; function downtoggle(e){ isactive = isactive==='true'?true:false; console.log(isactive); if( isactive ) { downli.removeclass(showani).addclass(hideani); self.onendanimation(downli[0],function(){ down.hide(); self.isanimating = false; }); // callback on close isclose( e ); } else { down.show(); downli.removeclass(hideani).addclass(showani); // callback on open isopen( e ); } isactive = !isactive; e.parents('.layout-down').attr('data-on',isactive); } downtoggle(down); downli.on('click',function(){ var txt = $(this).html(); txtbox.html(txt); }); }); }, //手机菜单动画 appnav: function(){ var self = this, appnav = $('.app-nav'), getapp = appnav.find('.getappnav'), appul = appnav.find('ul'), appli = appul.find('li'), appdown = appli.find('.child-nav'), appulwid = appul.attr('data-width'), showani = appul.attr('data-effect'), hideani = appul.attr('data-hideani'); appul.css('width',(this.windowwidth*appulwid)+'px'); getapp.on('click',function(e){ if(self.isanimating1) return false; self.isanimating1 = true; var isactive = $(this).hasclass('menuactive'); $(this).toggleclass('menuactive'); if(isactive){ appli.removeclass(showani).addclass(hideani); for(var i=0;i