GalleriaGalleria is a content gallery component.

Galleria - 图1

Documentation

Import

  1. import {GalleriaModule} from 'primeng/galleria';
  2.  

Getting Started

Galleria requires a set of images to display. Source attribute defines the path of the image whereas title and alt attributes are used in the caption section to display summary and description about an image.

  1. <p-galleria [images]="images" panelWidth="500" panelHeight="313" [showCaption]="true"></p-galleria>
  2.  
  1. export class GalleriaDemo implements OnInit {
  2. images: any[];
  3. ngOnInit() {
  4. this.images = [];
  5. this.images.push({source:'assets/showcase/images/demo/galleria/galleria1.jpg', alt:'Description for Image 1', title:'Title 1'});
  6. this.images.push({source:'assets/showcase/images/demo/galleria/galleria2.jpg', alt:'Description for Image 2', title:'Title 2'});
  7. this.images.push({source:'assets/showcase/images/demo/galleria/galleria3.jpg', alt:'Description for Image 3', title:'Title 3'});
  8. this.images.push({source:'assets/showcase/images/demo/galleria/galleria4.jpg', alt:'Description for Image 4', title:'Title 4'});
  9. this.images.push({source:'assets/showcase/images/demo/galleria/galleria5.jpg', alt:'Description for Image 5', title:'Title 5'});
  10. this.images.push({source:'assets/showcase/images/demo/galleria/galleria6.jpg', alt:'Description for Image 6', title:'Title 6'});
  11. this.images.push({source:'assets/showcase/images/demo/galleria/galleria7.jpg', alt:'Description for Image 7', title:'Title 7'});
  12. this.images.push({source:'assets/showcase/images/demo/galleria/galleria8.jpg', alt:'Description for Image 8', title:'Title 8'});
  13. this.images.push({source:'assets/showcase/images/demo/galleria/galleria9.jpg', alt:'Description for Image 9', title:'Title 9'});
  14. this.images.push({source:'assets/showcase/images/demo/galleria/galleria10.jpg', alt:'Description for Image 10', title:'Title 10'});
  15. this.images.push({source:'assets/showcase/images/demo/galleria/galleria11.jpg', alt:'Description for Image 11', title:'Title 11'});
  16. this.images.push({source:'assets/showcase/images/demo/galleria/galleria12.jpg', alt:'Description for Image 12', title:'Title 12'});
  17. }
  18. }
  19.  

Properties

NameTypeDefaultDescription
panelWidthnumber600Width of the content panel.
panelHeightnumber400Height of the content panel.
frameWidthnumber60Width of the filmstrip frames.
frameHeightnumber40Height of the filmstrip frames.
showFilmstripbooleantrueDefines visibility of filmstrip.
autoPlaybooleantrueImages are displayed with a slideshow in autoPlay mode.
transitionIntervalnumber4000Time in milliseconds between each slide in autoPlay mode.
effectDurationnumber250Duration of animation in milliseconds.
showCaptionbooleantrueDisplays information retrieved from title and alt attributes of images in content caption.
activeIndexnumber0Index of the current active image of galleria images.

Events

NameParametersDescription
onImageClicked event.image: Image Object event.originalEvent: Click Object event.index: Index of the image Callback to invoke when the displayed image is clicked.
onImageChange event.index: Index of the image Callback to invoke when an image changes.

Styling

Following is the list of structural style classes, for theming classes visit theming page.

NameElement
ui-galleriaContainer element
ui-galleria-panel-wrapperParent of item containers.
ui-galleria-filmstrip-wrapperContainer of filmstrip.
ui-galleria-filmstripFilmstrip element
ui-galleria-frameFrame element of thumbnail
ui-galleria-nav-nextIcon to navigate to next item
ui-galleria-nav-prevIcon to navigate to previous item
ui-galleria-captionCaption element that displays title and description of an item

Dependencies

None.

Source

View on GitHub

  1. <p-galleria [images]="images" panelWidth="500" panelHeight="313" showCaption="true"></p-galleria>
  2.  
  1. export class GalleriaDemo implements OnInit {
  2. images: any[];
  3. ngOnInit() {
  4. this.images = [];
  5. this.images.push({source:'assets/showcase/images/demo/galleria/galleria1.jpg', alt:'Description for Image 1', title:'Title 1'});
  6. this.images.push({source:'assets/showcase/images/demo/galleria/galleria2.jpg', alt:'Description for Image 2', title:'Title 2'});
  7. this.images.push({source:'assets/showcase/images/demo/galleria/galleria3.jpg', alt:'Description for Image 3', title:'Title 3'});
  8. this.images.push({source:'assets/showcase/images/demo/galleria/galleria4.jpg', alt:'Description for Image 4', title:'Title 4'});
  9. this.images.push({source:'assets/showcase/images/demo/galleria/galleria5.jpg', alt:'Description for Image 5', title:'Title 5'});
  10. this.images.push({source:'assets/showcase/images/demo/galleria/galleria6.jpg', alt:'Description for Image 6', title:'Title 6'});
  11. this.images.push({source:'assets/showcase/images/demo/galleria/galleria7.jpg', alt:'Description for Image 7', title:'Title 7'});
  12. this.images.push({source:'assets/showcase/images/demo/galleria/galleria8.jpg', alt:'Description for Image 8', title:'Title 8'});
  13. this.images.push({source:'assets/showcase/images/demo/galleria/galleria9.jpg', alt:'Description for Image 9', title:'Title 9'});
  14. this.images.push({source:'assets/showcase/images/demo/galleria/galleria10.jpg', alt:'Description for Image 10', title:'Title 10'});
  15. this.images.push({source:'assets/showcase/images/demo/galleria/galleria11.jpg', alt:'Description for Image 11', title:'Title 11'});
  16. this.images.push({source:'assets/showcase/images/demo/galleria/galleria12.jpg', alt:'Description for Image 12', title:'Title 12'});
  17. }
  18. }
  19.