Yui: различия между версиями

2045 байт добавлено ,  14 лет назад
нет описания правки
Нет описания правки
Нет описания правки
 
<h3><span>Menu (Меню)</span></h3>
'''Простое динамическое меню:'''
<source lang="javascript">
<!-- 1 -->
<link rel="stylesheet" type="text/css" href="yui/build/fonts/fonts-min.css" />
<link rel="stylesheet" type="text/css" href="yui/build/menu/assets/skins/sam/menu.css" />
<script type="text/javascript" src="yui/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="yui/build/container/container_core.js"></script>
<script type="text/javascript" src="yui/build/menu/menu.js"></script>
<!-- 1 -->
 
<!-- 2 -->
<script type="text/javascript">
YAHOO.util.Event.onDOMReady(function () {
var oMenu = new YAHOO.widget.Menu("menuwithgroups", { fixedcenter: true });
 
oMenu.addItems([
 
[
{ text: "Yahoo! Mail", url: "http://mail.yahoo.com" },
{ text: "Yahoo! Address Book", url: "http://addressbook.yahoo.com" },
{ text: "Yahoo! Calendar", url: "http://calendar.yahoo.com" },
{ text: "Yahoo! Notepad", url: "http://notepad.yahoo.com" }
],
 
[
 
{ text: "Yahoo! Local", url: "http://local.yahoo.com" },
{ text: "Yahoo! Maps", url: "http://maps.yahoo.com" },
{ text: "Yahoo! Travel", url: "http://travel.yahoo.com" },
{ text: "Yahoo! Shopping", url: "http://shopping.yahoo.com" }
],
 
[
 
{ text: "Yahoo! Messenger", url: "http://messenger.yahoo.com" },
{ text: "Yahoo! 360", url: "http://360.yahoo.com" },
{ text: "Yahoo! Groups", url: "http://groups.yahoo.com" },
{ text: "Yahoo! Photos", url: "http://photos.yahoo.com" }
]
]);
 
oMenu.showEvent.subscribe(function () {
 
this.focus();
});
oMenu.render("rendertarget");
YAHOO.util.Event.addListener("menutoggle", "click", oMenu.show, null, oMenu);
});
</script>
 
<button id="menutoggle" type="button">Show Menu</button>
<div id="rendertarget"></div>
<!-- 2 -->
</source>
 
258

правок