@tower1229/flow-ui
Version:
Highly customizable UI framework based Seajs/jQuery
69 lines (62 loc) • 1.36 kB
JavaScript
/**
* name: common
* version: v4.0.1
* update: 移除响应式功能
* date: 2017-04-07
*/
define(function(require, exports, module) {
var $ = require('jquery');
var base = require('base');
if (base.browser.ie < 8) {
alert('您的浏览器版本过低,请升级或使用chrome、Firefox等高级浏览器!');
//屏蔽ie78 console未定义错误
if (typeof console === 'undefined') {
console = {
log: function() {},
warn: function() {}
};
}
}
//返回顶部
$('body').on('click', '.gotop', function() {
$('html,body').stop(1).animate({
scrollTop: '0'
}, 300);
return false;
});
//textarea扩展max-length
$('textarea[max-length]').on('change blur keyup', function() {
var _val = $(this).val(),
_max = $(this).attr('max-length');
if (_val.length > _max) {
$(this).val(_val.substr(0, _max));
}
});
//延时显示
if (base.browser.ie < 9) {
$('.opc0').css('filter', 'unset');
} else {
$('.opc0').animate({
'opacity': '1'
}, 160);
}
// placeholder
require('placeholder');
$('input, textarea').placeholder();
/*
* 输出
*/
module.exports = {
demo: function() {
var directHash = {
"0": "重定向",
"1": "刷新",
"2": "历史记录"
};
console.log('页面来自' + directHash[window.performance.navigation.type]);
}
};
/*
* 站内公用
*/
});