Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Little fixes on menu and demo update #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions nav/menu/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
padding:0.5em 1em;
cursor: pointer;
}
#menu2{
relative: absolute;
top: 200px;
}
</style>
</head>
<body>
Expand Down Expand Up @@ -50,6 +54,7 @@ <h1>Menu</h1>

</li>
</ul>

<ul id='menu2'>
<li>A
<ul>
Expand Down Expand Up @@ -81,14 +86,34 @@ <h1>Menu</h1>
</li>
</ul>

<script type='text/javascript'
<script type='text/javascript'
src='../../../steal/steal.js'>
</script>
<script type='text/javascript'>
steal('mxui/nav/menu').then(function(){
$("#menu1").mxui_nav_menu();
$("#menu2").mxui_ui_menu().show().trigger("move", {top: 60, left: 280});
});
$("#menu1").mxui_nav_menu();

Mxui.UI.Menu.extend("Enhanced.UI.menu", {},
{
"mouseleave": function(el,e){
if(this.options.level == 0){
this.element.children('.'+this.options.select).trigger('deactivate')
}
},
">show" : function(el, ev){
if(ev.target == this.element[0]){
this.element.show();
// prevent the event to trigger the positionable "show" handler
ev.stopPropagation()
this.element.children('.'+this.options.active+":first").trigger('deactivate')
}
}

})

$("#menu2").enhanced_ui_menu().show()

});
</script>
</body>
</html>
6 changes: 4 additions & 2 deletions nav/menu/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ steal('mxui/layout/positionable','mxui/nav/menuable','jquery/event/hover').then(
">show" : function(el, ev){
if(ev.target == this.element[0]){
this.element.show();
}
// prevent the event to trigger the positionable "show" handler
ev.stopPropagation()
}

}
});
Expand Down Expand Up @@ -145,7 +147,7 @@ steal('mxui/layout/positionable','mxui/nav/menuable','jquery/event/hover').then(
*/
Mxui.Nav.Menu.extend("Mxui.UI.Menu",{
defaults: {
types : [Mxui.Layout.Positionable("Mxui.UI.TopLeft",{defaults: {my: "left top",at: "right top"}},{}),
types : [Mxui.Layout.Positionable("Mxui.UI.TopLeft",{defaults: {my: "left top",at: "right top", keep:true}},{}),
Mxui.UI.Highlight],
select_event : "hoverenter",
child_selector : "li",
Expand Down
2 changes: 1 addition & 1 deletion nav/menuable/menuable.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ steal('jquery/controller',
if(this.activating)
return;
this.activating = true;
var options = this.options, oldActive = this.find("."+options.active+":first"), self= this;
var options = this.options, oldActive = this.element.children("."+options.active+":first"), self= this;

ev.pause();
var doThis = function(){
Expand Down