Skip to content

Commit

Permalink
Fix another hover bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Altmann committed Feb 6, 2015
1 parent 7bfbead commit 6522986
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/assets/javascripts/visual/touchhover.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,26 @@ $ ->
.fitIntoViewport()

mouseenter: (e) ->
console.log 'Bingo'
e.preventDefault()
$(@)
.addClass('touched')
.children('.TouchHover--hidden')
.fitIntoViewport()

mouseout: (e) ->
unless $(e.target).hasClass('TouchHover') or $(e.target).parent().hasClass('TouchHover')
#unless $(e.target).hasClass('TouchHover') or $(e.target).parent().hasClass('TouchHover')
# return true

# Check if related target is Browser UI
if e.relatedTarget is null
return true

$rel_target = $(e.relatedTarget)

console.log 'First step...', $rel_target

$rel_ancestor = $rel_target.closest('.TouchHover')
if $rel_ancestor.length is 1 and $rel_ancestor[0] is @
return true
console.log 'Got through!', $rel_target

e.preventDefault()
$(@).removeClass('touched')

Expand Down

0 comments on commit 6522986

Please sign in to comment.