I'm using Fotorama 4.5.0 (Rails gem) and I have a problem with getting the API object. 

On page load Fotorama is in hidden div. It opens in modal on click.  

Here is the code (coffee):

```
$objects = $('*[rel="fotorama"]')
$fotorama_div = $('.fotorama')

$fotorama_div
.on('fotorama:showend', (e, fotorama, extra) ->
  // resizing fotorama
).fotorama()
fotorama = $fotorama_div.data('fotorama')
console.log(fotorama) // here is undefined

$objects.on 'click', ->
  // finding index of an image
  modal.open({content: $('#fotorama-container')})
  fotorama.show(index) // index is ok

```

With this code `fotorama` object is always `undefined`.  

Ok, I added `if` with check:

```
$objects = $('*[rel="fotorama"]')
$fotorama_div = $('.fotorama')

$fotorama_div
.on('fotorama:showend', (e, fotorama, extra) ->
  // resizing fotorama
).fotorama()
fotorama = $fotorama_div.data('fotorama')
console.log(fotorama) // here is undefined

$objects.on 'click', ->
  // finding index of an image
  modal.open({content: $('#fotorama-container')})
  if typeof fotorama == "undefined"
    fotorama = $fotorama_div.data('fotorama')
    console.log(fotorama) // here is undefined after the first click on object
  fotorama.show(index) // index is ok

```

After the first click on object — `fotorama` is still `undefined`, but after I'm closing a modal and doing the second click — I get `fotorama` object and everything works as expected.

And when I doing `$fotorama_div.data('fotorama')` in console, it works.

How can I get `fotorama` object on page load?