Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $=jQuery
- class ApplicationMenu
- constructor: (nome) ->
- @menu = $ ".menu"
- @menu.find("li").click @click
- @menu.find("ul .children").attr("class","children menuBorder").hide().each (i,e) ->
- el = $ e
- el.parent().data("__menu", el)
- el.remove()
- $(document.body).append el
- @menuIsShow = false
- @active = null
- click: (e) =>
- el = $ e.currentTarget
- #hasChilds = el.find("ul").length>0 ? true : false
- child = el.data("__menu")
- if child != undefined
- @menuIsShow = true
- @active = child
- #@active = $(el.find('ul')[0]).fadeIn("slow")
- pos = el.offset()
- @active.css({"left":pos.left-12,"top":pos.top+8,"bottom":0}).fadeIn("fast")
- $(document.body).bind "mouseup", @hide
- return false
- hide: (e) =>
- if @menuIsShow
- @active.fadeOut("fast")
- $(document.body).unbind "mouseup", @hide
- $ ->
- new ApplicationMenu()
- ###
- <style type="text/css">
- li {
- float: left;
- display: inline;
- }
- .menuBorder {
- position: absolute;
- margin-right: 12px;
- margin-left: 12px;
- -webkit-border-radius: 12px 12px 0px 0px;
- border-radius: 12px 12px 0px 0px;
- border: 1px solid #fff;
- /*outline: 2px solid #ffffff;*/
- /*outline-offset: 10px; Delete if you don't want an offset*/
- background: -moz-linear-gradient(top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.8) 57%, rgba(0,0,0,0) 100%); /* FF3.6+ */
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.8)), color-stop(57%,rgba(0,0,0,0.8)), color-stop(100%,rgba(0,0,0,0))); /* Chrome,Safari4+ */
- background: -webkit-linear-gradient(top, rgba(0,0,0,0.8) 0%,rgba(0,0,0,0.8) 57%,rgba(0,0,0,0) 100%); /* Chrome10+,Safari5.1+ */
- background: -o-linear-gradient(top, rgba(0,0,0,0.8) 0%,rgba(0,0,0,0.8) 57%,rgba(0,0,0,0) 100%); /* Opera 11.10+ */
- background: -ms-linear-gradient(top, rgba(0,0,0,0.8) 0%,rgba(0,0,0,0.8) 57%,rgba(0,0,0,0) 100%); /* IE10+ */
- background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%,rgba(0,0,0,0.8) 57%,rgba(0,0,0,0) 100%); /* W3C */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cc000000', endColorstr='#00000000',GradientType=0 ); /* IE6-9 */
- }
- </style>
- ###
Advertisement
Add Comment
Please, Sign In to add comment