ImageSwitch is an image gallery component with 25+ effects.
<div class="card">
<h5 style="margin-top:0">Manual</h5>
<p:commandButton type="button" onclick="PF('switcher').previous()"
icon="pi pi-chevron-left" id="prev" styleClass="mr-2 mb-3" />
<p:commandButton type="button" onclick="PF('switcher').next()"
icon="pi pi-chevron-right" id="next" styleClass="mr-2 mb-3" />
<p:imageSwitch effect="wipe" widgetVar="switcher" id="manuelSwitcher"
slideshowAuto="false">
<ui:repeat value="#{imagesView.images}" var="image" id="manuelSwitcherImages">
<p:graphicImage name="/demo/images/nature/#{image}" id="image"/>
</ui:repeat>
</p:imageSwitch>
</div>
<div class="card">
<h5>Fade</h5>
<p:imageSwitch effect="fade" id="fadeEffect">
<ui:repeat value="#{imagesView.images}" var="image" id="fadeEffectImages">
<p:graphicImage name="/demo/images/nature/#{image}" id="image2"/>
</ui:repeat>
</p:imageSwitch>
</div>
<div class="card">
<h5>Zoom</h5>
<p:imageSwitch effect="zoom">
<ui:repeat value="#{imagesView.images}" var="image">
<p:graphicImage name="/demo/images/nature/#{image}"/>
</ui:repeat>
</p:imageSwitch>
</div>
<div class="card">
<h5>TurnDown</h5>
<p:imageSwitch effect="turnDown">
<ui:repeat value="#{imagesView.images}" var="image">
<p:graphicImage name="/demo/images/nature/#{image}"/>
</ui:repeat>
</p:imageSwitch>
</div>
<div class="card">
<h5>Shuffle</h5>
<p:imageSwitch effect="shuffle">
<ui:repeat value="#{imagesView.images}" var="image">
<p:graphicImage name="/demo/images/nature/#{image}"/>
</ui:repeat>
</p:imageSwitch>
</div>
<div class="card">
<h5>Dialog Integration</h5>
<p:commandButton type="button" value="Show" onclick="PF('dlg').show()" icon="pi pi-home"/>
<p:dialog header="Images" widgetVar="dlg" modal="true"
draggable="false" resizable="false" showEffect="fade" hideEffect="fade">
<p:imageSwitch effect="fade">
<ui:repeat value="#{imagesView.images}" var="image">
<p:graphicImage name="/demo/images/nature/#{image}"/>
</ui:repeat>
</p:imageSwitch>
</p:dialog>
</div>
package org.primefaces.showcase.view.multimedia;
import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Named;
import java.util.ArrayList;
import java.util.List;
import io.quarkus.runtime.annotations.RegisterForReflection;
@Named
@RequestScoped
@RegisterForReflection(serialization = true)
public class ImagesView {
private List<String> images;
@PostConstruct
public void init() {
images = new ArrayList<String>();
for (int i = 1; i <= 12; i++) {
images.add("nature" + i + ".jpg");
}
}
public List<String> getImages() {
return images;
}
}