fd-gulp-convert-encoding
Version:
convert file to assigned charset
88 lines (63 loc) • 1.9 kB
JavaScript
/**
* @author dongming.jidm
* @date 2013-01-07
* design for responsive
*/
;(function($){
var self,QU = Qingguo.Utility;
var defConfig = {
responsivelink: '#responsive_css',
layout990: 'http://style.c.aliimg.com/app/qingguo/css/module/responsive/media-990.css',
layout990to1440: 'http://style.c.aliimg.com/app/qingguo/css/module/responsive/media-990-1440.css',
layout1440: 'http://style.c.aliimg.com/app/qingguo/css/module/responsive/media-1440.css'
}
function Responsive(sb) {
Sandbox = sb;
return Responsive;
}
$.extend(Responsive,{
init: function(){
if( typeof window.matchMedia === 'function' ) {
return ;
}
self = this;
self.lt990 = false;
self.bt9901440 = false;
self.gt1440 = false;
self.__bindEvent();
},
__bindEvent: function() {
$(window).resize(function() {
var width = self.__checkWindowWidth();
self.__doResponsive(width);
});
},
__checkWindowWidth: function() {
var width = $(window).innerWidth();
return width;
},
__doResponsive: function( width ) {
if( width <= 970 && !self.lt990 ) {
$(defConfig.responsivelink).attr('href', defConfig.layout990);
self.lt990 = true;
self.bt9901440 = false;
self.gt1440 = false;
}
if( width > 970 && width < 1420 && !self.bt9901440 ) {
$(defConfig.responsivelink).attr('href', defConfig.layout990to1440);
self.bt9901440 = true;
self.lt990 = false;
self.gt1440 = false;
}
if( width >= 1420 && !self.gt1440 ) {
$(defConfig.responsivelink).attr('href', defConfig.layout1440);
self.gt1440 = true;
self.lt990 = false;
self.bt9901440 = false;
}
},
end: 0
});
Qingguo.Business.Responsive = Responsive;
AppCore.register("qingguo_mod_responsive", Qingguo.Business.Responsive);
})(jQuery);