     $currentTarget = null
 
 
-  $(".js-modal-trigger").on "click", ->
-    target = $(this).data("modal-target")
-    $modal.trigger("show",target)+  $(document)
+    .on 'click', ".js-modal-trigger", ->
+      target = $(this).data("modal-target")
+      $modal.trigger("show",target)
    if $currentTarget != null
      $currentTarget.hide()
    $currentTarget = $(target)
    $overlay.show()
    $currentTarget.show()

  $modal.on "hide", (e) ->

  #
  # <button class="js-modal-trigger" data-modal-target="#target">

  $modal = $("<div class='js-modal'>")
  $overlay = $('<div class="js-modal__overlay">')
  $overlay.css {
    display: "none"
    position: "fixed"
