1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- //命名空间
- Namespace.register("U.Control.FoldMenu");
- /*
- //控件元素生成函数
- */
- U.Control.FoldMenu.Createframe = function (data, container) {
- if (data.length) {
- var nav = $$("div", { "class": "U_Control_FoldMenu_nav" }, container);
- var MainMenuWarp = $$("div", { "class": "U_Control_FoldMenu_main_menu" }, nav);
- U.Control.FoldMenu.CreateElement(data,MainMenuWarp);
- }
- }
- /*
- //控件元素生成函数
- */
- U.Control.FoldMenu.CreateElement = function (data, container) {
- var i;
- for (var i = 0; i < data.length; i++) {
- var a_menu_title = $$("a", { "class": "U_Control_FoldMenu_menu_title" }, container); //创建ayuans
- a_menu_title.onclick = function () { U.Control.FoldMenu.Lishow(this); } //赋值a元素点击事件
- //var img = $$("img",{"class":"U_Control_FoldMenu_Icon",'src':'img/JT.png'},a_menu_title);//创建控件菜单箭头元素
- data[i].submenu ? $$("img", { "class": "U_Control_FoldMenu_Icon", 'src': 'img/JT.png' }, a_menu_title) : "";
- var spna = $$("span", { "innerHTML": data[i].text }, a_menu_title); //创建控件菜单名字
- if (data[i].submenu) {
- var subMenu = $$("div", { "class": "U_Control_FoldMenu_subMenu", "style": { "display": "none", "padding-left": "10px"} }, container);
- U.Control.FoldMenu.CreateElement(data[i].submenu, subMenu);
- }
- }
- }
- /*
- //子菜单显示函数
- //e 事件源元素(event对象)
- */
- U.Control.FoldMenu.Lishow = function (e) {
- var div = e.nextSibling;
- if(div){
- if(div.style.display=="none"){
- div.style.display="block";
- U.Control.FoldMenu.TS(e,90);
- e.className +=" U_Control_FoldMenu_menu_title_active";
- }else{
- div.style.display="none";
- U.Control.FoldMenu.TS(e,0);
- e.className = "U_Control_FoldMenu_menu_title";
- }
- }
- }
- /*
- //图片旋转样式改变函数
- //目标对象
- //n 旋转度数
- */
- U.Control.FoldMenu.TS=function(e,n){
- e.getElementsByTagName("img")[0].style.webkitTransform="rotate("+n+"deg)";
- e.getElementsByTagName("img")[0].style.MozTransform="rotate("+n+"deg)";
- e.getElementsByTagName("img")[0].style.msTransform="rotate("+n+"deg)";
- e.getElementsByTagName("img")[0].style.OTransform="rotate("+n+"deg)";
- e.getElementsByTagName("img")[0].style.transform="rotate("+n+"deg)";
- }
|