       timeToIdle: null
 
     if _.startsWith(galleryId, 'contest-')
-      new _exported.GalleryContest(@container[0], pswp)
+      new _exported.GalleryContest(container, pswp)
 
     pswp.init()
 

    $(document).on 'click', '.js-gallery-thumbnail', @switchPreview

    $(document).on 'turbolinks:before-cache', ->
      $('.pswp--open').remove()


  initiateOpen: (e) =>



  open: ({galleryId, index}) =>
    container = @container[0].cloneNode(true)
    container.classList.add 'js-gallery--container'
    document.body.appendChild container

    pswp = new PhotoSwipe container,
      PhotoSwipeUI_Default
      @data galleryId
      showHideOpacity: true
