Sha256: 78e1a11e52e998da5613d31843c28d8c8f8f89fe52e3a7eb1496a3f180e5fdb5

Contents?: true

Size: 504 Bytes

Versions: 3

Compression:

Stored size: 504 Bytes

Contents

ready = () ->
  menus = document.getElementsByClassName('context-menu')
  Array.prototype.forEach.call(menus, (menu)->
    context_id = menu.dataset.context
    context    = document.getElementById(context_id)
    $(context).on 'click', (e)->
      $(menu).css {
        top:  e.pageY,
        left: e.pageX
      }
      $(menu).addClass('opened')
      e.stopPropagation()

    $(window).on 'click', ->
      $(menu).removeClass('opened')
  )

$(document).on 'page:load', ready
$(document).ready ready

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
more_responsive_less_u_i-rails-0.0.7 app/assets/javascripts/elements/contextmenu.js.coffee
more-responsive-less-ui-0.0.3 app/assets/javascripts/elements/contextmenu.js.coffee
more-responsive-less-ui-0.0.2 app/assets/javascripts/elements/contextmenu.js.coffee