This repository was archived by the owner on Nov 19, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed
src/guides/v2.3/javascript-dev-guide/widgets Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -580,3 +580,56 @@ api.updateOptions([{
580
580
[ Fotorama widget ] : http://fotorama.io/
581
581
[ lib/web/mage/gallery/gallery.js] : {{ site.mage2bloburl }}/{{ page.guide_version }}/lib/web/mage/gallery/gallery.js
582
582
[ 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
+ ```
626
+
627
+ The breakpoints options are set in the ` view.xml ` configuration file of a theme. The file is located in ` <theme_dir>/etc ` .
628
+
629
+ ``` xml
630
+ <var name =" breakpoints" >
631
+ <var name =" %breakpoints_option1%" >%option1_value%</var >
632
+ <var name =" %breakpoints_option2%" >%option2_value%</var >
633
+ ...
634
+ </var >
635
+ ```
You can’t perform that action at this time.
0 commit comments