Skip to content

Commit

Permalink
Try out mouseout event
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Altmann committed Feb 6, 2015
1 parent 023d683 commit ee493c4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
22 changes: 22 additions & 0 deletions app/assets/javascripts/visual/touchhover.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,25 @@ $ ->
.children('.TouchHover--hidden')
.fitIntoViewport()
)
.on('mouseenter', '.TouchHover', (e) ->
console.log 'Bingo'
e.preventDefault()
$(@)
.addClass('touched')
.children('.TouchHover--hidden')
.fitIntoViewport()
)
.on('mouseout', '.TouchHover', (e) ->
unless $(e.target).hasClass('TouchHover') or $(e.target).parent().hasClass('TouchHover')
return true

console.log 'First step...'
$rel_target = $(e.relatedTarget)


if $rel_target.closest('.TouchHover').length isnt 0
return true
console.log 'Got through!', $rel_target
e.preventDefault()
$(@).removeClass('touched')
)
1 change: 0 additions & 1 deletion app/assets/stylesheets/modules/_touchhover.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ TouchHover module
display: none;
}

.TouchHover:hover > .TouchHover--hidden,
.TouchHover.touched > .TouchHover--hidden {
display: block;
}
Expand Down

0 comments on commit ee493c4

Please sign in to comment.