javascript - fotorama: can't get the API object (undefined) -
I am using Fotorama 4.5.0 (Rail Gem) and I have a problem getting API object.
Photomars are in hidden lights on page load, it opens in the modal on click.
Here is the code:
$ objects = $ ('* [rel = "fotorama"]') $ fotorama_div = $ ('.fotorama') $ fotorama_div .on ('fotorama: showend', (e, fotorama, additional) -> 3 resizing photamera). Fontma () fotorama = $ fotorama_div.data ('fotorama') console.log (fotorama) // Here $ objects are undefined. On 'click', - & gt; // Find an index of an image modal.open ({content: $ ('# fotorama-container'}}) fotorama.show (index) // index is correct With Photomarma the object is always undefined .
OK, I've added the if with check: $ objects $ $ ('* [rel = "fotorama"]) $ fotorama_div = $ ('. Fotorama') $ fotorama_div .on ('Fotarma: Shawn', (E, Photarma, additional) -> Resizing Photarma) .fotorama () fotorama = $ fotorama_div.data ('fotorama') console. Log (fotorama) // There are no $ objects here. On 'click', - & gt; // Find an index of an image modal.open ({Content: $ ('#Fontma-Container')}) If typefororama == "undefined" fotorama = $ fotorama_div.data ('fotorama') console.log (fotorama) ) // Here the object is undefined after the first click on fotorama. Show (index) // index is ok after first click on object ???? fotorama is still undefined , but when I'm closing a modal and the other click ??? I get the object fotorama and everything works as expected. And when I am doing $ fotorama_div.data ('fotorama') in the console, it works How do I get a fotorama item?
I had the exact same problem - by loading the photomas into a div "undefined" in the console After that, the photorama object was loaded correctly after displaying only the div.
I came to know that the reason for this is "object: none;" CSS Styling I do not know why, but if some of the hidden things are loaded into the fartma then it breaks.
I do not know any ROR, but my confidence will first show the model, then load the foreter $ fotorama_div.fotorama () after opening the modal.
Comments
Post a Comment