Skip to content

Commit

Permalink
Fix on Aside tablet
Browse files Browse the repository at this point in the history
Refactor error
  • Loading branch information
pinaypunto committed Jul 8, 2013
1 parent fd3cc63 commit 5a75c9e
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions src/modules/Lungo.Aside.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,31 @@ Lungo.Aside = do (lng = Lungo) ->
show = (aside_id, fixed = false) ->
aside = lng.dom("##{aside_id}")
if aside.length
if not fixed and not _alreadyOpen(aside_id)
fromX = 0
lng.Element.Cache.aside = aside
if lng.DEVICE is C.DEVICE.PHONE
aside.addClass(C.CLASS.SHOW)

aside_transition = aside.data(C.TRANSITION.ATTR) or "left"
lng.Element.Cache.section.data("aside-#{aside_transition}", "show")
unless _alreadyOpen(aside_id)
unless fixed
# not fixed
fromX = 0
lng.Element.Cache.aside = aside
if lng.DEVICE is C.DEVICE.PHONE
aside.addClass(C.CLASS.SHOW)
aside_transition = aside.data(C.TRANSITION.ATTR) or "left"
lng.Element.Cache.section.data("aside-#{aside_transition}", "show")
else
aside.addClass(C.CLASS.SHOW)
aside_section = lng.dom("[data-aside=#{aside_id}][data-children]")
if aside_section.attr("id") isnt lng.Element.Cache.section?.attr("id")
lng.Element.Cache.section.addClass "shadowing"
childs = aside_section.data("children")
childs = childs.split(" ")
for childid in childs
child = lng.dom(C.ELEMENT.SECTION + "#" + childid)
if child.length and child.hasClass(C.CLASS.SHOW) then child.addClass "shadowing"

aside_section.removeClass("aside").addClass "asideShowing"
else
aside.addClass(C.CLASS.SHOW)
aside_section = lng.dom("[data-aside=#{aside_id}][data-children]")
if aside_section.attr("id") isnt lng.Element.Cache.section?.attr("id")
lng.Element.Cache.section.addClass "shadowing"
childs = aside_section.data("children").split(" ")
for childsild in childs
child = lng.dom(C.ELEMENT.SECTION + "#" + child)
if child.length and child.hasClass(C.CLASS.SHOW) then child.addClass "shadowing"

aside_section.removeClass("aside").addClass "asideShowing"
else
lng.Element.Cache.aside = aside
aside.addClass(C.CLASS.SHOW).addClass("box")
# fixed
lng.Element.Cache.aside = aside
aside.addClass(C.CLASS.SHOW).addClass("box")

###
Hide current aside element
Expand Down

0 comments on commit 5a75c9e

Please sign in to comment.