📄 coolmenu.js
字号:
/*
* Class CoolMenu (based on ucren-widgets)
* Author:Dron
* Date:2007-9-8
* Contact:ucren.com
*/
function CoolMenu(config){
this.itemWidth = config.itemWidth || 100;
this.itemHeight = config.itemHeight || 20;
this.image = config.image || "";
this.imageLength = config.imageLength || 5;
this.flashTimeout = config.flashTimeout || 80,
this.itemMargin = config.itemMargin || 5;
this.data = config.data;
this.container = Ucren.getElement(config.container);
this.fontColor = config.fontColor || "#000";
this.activeFontColor = config.activeFontColor || "#fff";
};
Ucren.extend(CoolMenu, {
renderItem: function (config){
var name = config.name;
var url = config.url;
var action = config.action;
var itemdiv = this.container.createElement("div", {
position: "relative",
width: this.itemWidth + "px",
height: this.itemHeight + "px",
marginTop: this.itemMargin + "px"
});
var flashbgdiv = itemdiv.createElement("div", {
position: "absolute",
width: this.itemWidth + "px",
height: this.itemHeight + "px"
});
var namediv = itemdiv.createElement("div", {
position: "absolute",
width: this.itemWidth + "px",
height: this.itemHeight + "px",
textAlign: "center",
color: this.fontColor,
fontSize: "14px",
lineHeight: this.itemHeight + "px",
cursor: "pointer"
});
var fm = new Ucren.Film({
width: this.itemWidth,
height: this.itemHeight,
container: flashbgdiv,
length: this.imageLength,
image: this.image,
timeout: this.flashTimeout
});
fm.render();
namediv.setHtml(name);
itemdiv.on({
mouseover: (function (){ namediv.setStyle({ color: this.activeFontColor }); fm.play("-5"); }).createDelegate(this),
mouseout: (function (){ namediv.setStyle({ color: this.fontColor }); fm.play("-0"); }).createDelegate(this),
mouseup: (function (){
action && action();
url && (function (){
location.href = url;
})();
}).createDelegate(this)
});
},
render: function (){
if (!this.data || !this.container) return ;
var d = this.data, dc = d.count;
for (var i = 0; i < dc; i ++){
d.go(i);
this.renderItem({
name: d.read("name"),
url: d.read("url"),
action: d.read("action")
});
}
}
});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -