Set the Initial Image

By default, the image that the Gallery widget displays initially is the first item of the data source. To specify another item to be initially displayed, assign its index in the dataSource to the selectedIndex option.

JavaScript
$(function () {
    $("#galleryContainer").dxGallery({
        dataSource: [
            "https://js.devexpress.com/Content/images/doc/17_1/PhoneJS/person1.png",
            "https://js.devexpress.com/Content/images/doc/17_1/PhoneJS/person2.png",
            "https://js.devexpress.com/Content/images/doc/17_1/PhoneJS/person3.png"
        ],
        height: 300,
        selectedIndex: 2
    });
});

As an alternative, you can specify the initial image using its data source object. In this case, assign the object to the selectedItem option.

JavaScript
var galleryData = [{
    imageAlt: "Maria",
    imageSrc: "https://js.devexpress.com/Content/images/doc/17_1/PhoneJS/person1.png"
}, {
    imageAlt: "John",
    imageSrc: "https://js.devexpress.com/Content/images/doc/17_1/PhoneJS/person2.png"
}, {
    imageAlt: "Xavier",
    imageSrc: "https://js.devexpress.com/Content/images/doc/17_1/PhoneJS/person3.png"
}];

$(function () {
    $("#galleryContainer").dxGallery({
        dataSource: galleryData,
        height: 300,
        selectedItem: galleryData[1]
    });
});
See Also