All docs
V19.1
24.1
The page you are viewing does not exist in version 24.1.
23.2
The page you are viewing does not exist in version 23.2.
23.1
The page you are viewing does not exist in version 23.1.
22.2
The page you are viewing does not exist in version 22.2.
22.1
The page you are viewing does not exist in version 22.1.
21.2
The page you are viewing does not exist in version 21.2.
21.1
The page you are viewing does not exist in version 21.1.
20.2
The page you are viewing does not exist in version 20.2.
20.1
The page you are viewing does not exist in version 20.1.
19.2
19.1
18.2
18.1
17.2
A newer version of this page is available. Switch to the current version.

DevExtreme jQuery - Transform and Combine Images

By default, the Gallery widget displays one image at a time. To fit more images into a single Gallery view, specify the initialItemWidth option. In this case, the widget shows as many images scaled down to the initialItemWidth as it can display without cropping them.

jQuery
JavaScript
$(function () {
    $("#galleryContainer").dxGallery({
        dataSource: [
            "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person1.png",
            "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person2.png",
            "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person3.png",
            "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person4.png"
        ],
        height: 300,
        width: 600,
        initialItemWidth: 250
    });
});
Angular
HTML
TypeScript
<dx-gallery
    [dataSource]="galleryDataSource"
    [height]="300"
    [width]="600"
    [initialItemWidth]="250">
</dx-gallery>
import { DxGalleryModule } from "devextreme-angular";
// ...
export class AppComponent {
    galleryDataSource = [
        "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person1.png",
        "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person2.png",
        "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person3.png",
        "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person4.png"
    ];
}
@NgModule({
    imports: [
        // ...
        DxGalleryModule
    ],
    // ...
})

When distributing images along the total width, the Gallery may add margins between them. To eliminate them, assign true to the stretchImages option.

jQuery
JavaScript
$(function () {
    $("#galleryContainer").dxGallery({
        dataSource: [
            "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person1.png",
            "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person2.png",
            "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person3.png",
            "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person3.png"
        ],
        height: 200,
        width: 320,
        initialItemWidth: 120,
        stretchImages: true
    });
});
Angular
HTML
TypeScript
<dx-gallery
    [dataSource]="galleryDataSource"
    [height]="200"
    [width]="320"
    [initialItemWidth]="120"
    [stretchImages]="true">
</dx-gallery>
import { DxGalleryModule } from "devextreme-angular";
// ...
export class AppComponent {
    galleryDataSource = [
        "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person1.png",
        "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person2.png",
        "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person3.png",
        "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person4.png"
    ];
}
@NgModule({
    imports: [
        // ...
        DxGalleryModule
    ],
    // ...
})
NOTE
The width of an image when it is displayed in the Gallery cannot exceed its actual width.

The Gallery widget allows you to display not only the current image, but also parts of the previous and the next ones. To enable this feature, assign true to the wrapAround option. Note that in this case, the width of images will be less than the specified initialItemWidth.

jQuery
JavaScript
$(function () {
    $("#galleryContainer").dxGallery({
        dataSource: [
            "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person1.png",
            "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person2.png",
            "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person3.png",
            "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person3.png"
        ],
        height: 200,
        width: 320,
        initialItemWidth: 200,
        wrapAround: true
    });
});
Angular
HTML
TypeScript
<dx-gallery
    [dataSource]="galleryDataSource"
    [height]="200"
    [width]="320"
    [initialItemWidth]="200"
    [wrapAround]="true">
</dx-gallery>
import { DxGalleryModule } from "devextreme-angular";
// ...
export class AppComponent {
    galleryDataSource = [
        "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person1.png",
        "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person2.png",
        "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person3.png",
        "https://js.devexpress.com/Content/images/doc/19_1/PhoneJS/person4.png"
    ];
}
@NgModule({
    imports: [
        // ...
        DxGalleryModule
    ],
    // ...
})
See Also