Saturday, 23 January 2016

Carousel Slide In Visualforce

The Carousel plugin is a component for cycling through elements, like a carousel (slideshow).

Today, am going to show how to create Carousel slide effect in Visualforce Page.

First download the required files that are mentioned below and add them to the static resource of salesforce org.

So, here is my code for Carousel slide effect in Visualforce Page.

<apex:page docType="html-5.0" showHeader="false" sidebar="false">
<html lang="en">
  <title>Casousel Slide Example</title>
  <apex:includeScript value="{!$Resource.jQuery182min}"/>
  <script src="" type="text/javascript">               </script>

  <meta charset="utf-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
  <apex:stylesheet value="{!$Resource.bootstrapmincss}"/>
  <apex:includeScript value="{!$Resource.jqueryminjs}"/>
  <apex:includeScript value="{!$Resource.bootstrapminjs}"/>
  .carousel-inner > .item > img,
  .carousel-inner > .item > a > img {
      width: 70%;
      height: 500px;
      margin: auto;

<div class="container">
  <div id="myCarousel" class="carousel slide" data-ride="carousel">
    <!-- Indicators -->
    <ol class="carousel-indicators">
      <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
      <li data-target="#myCarousel" data-slide-to="1"></li>
      <li data-target="#myCarousel" data-slide-to="2"></li>
      <li data-target="#myCarousel" data-slide-to="3"></li>

    <!-- Wrapper for slides -->
    <div class="carousel-inner" role="listbox">
      <div class="item active">
        <img src="{!URLFOR($Resource.MinionsDemo, 'Minion/1.jpg')}" alt="Minion1" width="460" height="345"/>
      </div >

      <div class="item">
        <img src="{!URLFOR($Resource.MinionsDemo, 'Minion/2.jpg')}" alt="Minion2" width="460" height="345"/>
      </div >
      <div class="item">
        <img src="{!URLFOR($Resource.MinionsDemo, 'Minion/3.jpg')}" alt="Minion3" width="460" height="345"/>
      </div >

      <div class="item">
        <img src="{!URLFOR($Resource.MinionsDemo, 'Minion/4.jpg')}" alt="Minion4" width="460" height="345"/>

    <!-- Left and right controls -->
    <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
      <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
      <span class="sr-only">Previous</span>
    <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
      <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
      <span class="sr-only">Next</span>

<script src="" type="text/javascript"></script>
<script src="" type="text/javascript"></script>
<script src="" type="text/javascript"></script>
<script src="" type="text/javascript"></script>

output :


1 comment:

  1. Hi mohammed,
    How can I use this Slider if i want to dynamically display Slides From Attachments of a Record.rather than hardcoding Image Url here