/** * 常用组件库 * **/ /* 网站右下角悬浮常用组件 */ function Fixed() { this.fixed = null this.setting = { type: '1', colorStyle: 'blue' } } // 初始化 Fixed.prototype.init = function(opt){ extend(this.setting, opt) this.create() } // 创建元素 Fixed.prototype.create =function(){ this.fixed = document.createElement('div') this.fixed.className = 'conponent_fixed' this.fixed.innerHTML = '

123

' document.body.appendChild(this.fixed) } function extend(defaultVal, newVal) { for(var e in newVal) { defaultVal[e] = newVal[e] } }