I need to move the product gallery navigation thumbnails on horizontal position if the screen is less than 768px wide.
For this I need to hook up on a callback that is triggered after the gallery is completely loaded.
How to do this when the gallery widget is initialized via the x-magento-init
method:
<script type="text/x-magento-init">
{
"[data-gallery-role=gallery-placeholder]": {
"mage/gallery/gallery": {
...
}
}
}
</script>
I tried adding:
<script type="text/javascript">
require(['jquery', 'mage/gallery/gallery'], function($, gallery){
console.log($('[data-gallery-role=gallery-placeholder]').data('gallery'));
});
</script>
And it outputs undefined
. But when I call the same thing from the console (after the gallery was loaded) it contains the gallery object where I can call the fotorama API methods.
So how can I get the .data('gallery')
object after the gallery is initialized ?
Many thanks!