Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit dd00b38

Browse files
author
DashukVolodymyr
committed
magento/devdocs#: added example of using the gallery widget
1 parent 4bfd722 commit dd00b38

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

src/guides/v2.3/javascript-dev-guide/widgets/widget_gallery.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,3 +580,46 @@ api.updateOptions([{
580580
[Fotorama widget]: http://fotorama.io/
581581
[lib/web/mage/gallery/gallery.js]: {{ site.mage2bloburl }}/{{ page.guide_version }}/lib/web/mage/gallery/gallery.js
582582
[lib/web/magnifier/magnify.js]: {{ site.mage2bloburl }}/{{ page.guide_version }}/lib/web/magnifier/magnify.js
583+
584+
## Code sample
585+
586+
This example shows a use case for a gallery widget on any page.
587+
588+
```html
589+
<div class="image-gallery"></div>
590+
591+
<script>
592+
require ([
593+
'jquery',
594+
'mage/gallery/gallery'
595+
], function ($, gallery) {
596+
$(function () {
597+
$('.image-gallery').each(function (index, element) {
598+
gallery({
599+
options: {
600+
"nav": "false",
601+
"loop": "true",
602+
"arrows": "true"
603+
},
604+
data: [
605+
{ img: "<image_url_1>" },
606+
{ img: "<image_url_2>" },
607+
{ img: "<image_url_3>" }
608+
],
609+
fullscreen: {
610+
"navdir": "horizontal"
611+
},
612+
"breakpoints": {
613+
"<breakpoint_name>": {
614+
"conditions": {
615+
"max-width": "767px"
616+
},
617+
"options": {}
618+
}
619+
}
620+
}, element);
621+
});
622+
});
623+
});
624+
</script>
625+
```

0 commit comments

Comments
 (0)