डब्ल्यू3.सीएसएस

W3.CSS होम W3.CSS परिचय W3.CSS रंग W3.CSS कंटेनर W3.CSS पैनल W3.CSS बॉर्डर्स W3.CSS कार्ड W3.CSS डिफॉल्ट्स W3.CSS फ़ॉन्ट्स W3.सीएसएस गूगल W3.CSS टेक्स्ट W3.CSS राउंड W3.CSS पैडिंग W3.CSS मार्जिन W3.CSS डिस्प्ले W3.CSS बटन W3.CSS नोट्स W3.CSS उद्धरण W3.CSS अलर्ट W3.CSS टेबल्स W3.CSS सूचियाँ W3.CSS छवियां W3.CSS इनपुट्स W3.CSS बैज W3.CSS Tags W3.CSS प्रतीक W3.CSS उत्तरदायी W3.CSS लेआउट W3.CSS एनिमेशन W3.CSS प्रभाव W3.CSS बार्स W3.CSS ड्रॉपडाउन W3.CSS समझौते W3.CSS नेविगेशन W3.CSS साइडबार W3.CSS टैब्स W3.CSS पेजिनेशन W3.CSS प्रोग्रेस बार्स W3.CSS स्लाइड शो W3.CSS मोडल W3.CSS टूलटिप्स W3.CSS ग्रिड W3.CSS कोड W3.CSS फ़िल्टर W3.CSS रुझान W3.CSS केस W3.CSS सामग्री W3.CSS सत्यापन W3.CSS संस्करण W3.CSS मोबाइल

W3.CSS रंग

W3.CSS कलर क्लासेस W3.CSS रंग सामग्री W3.CSS रंग फ्लैट UI W3.CSS कलर मेट्रो UI W3.CSS रंग Win8 W3.CSS कलर आईओएस W3.CSS रंग फैशन W3.CSS रंग पुस्तकालय W3.CSS रंग योजनाएं W3.CSS कलर थीम्स W3.CSS कलर जेनरेटर

वेब बिल्डिंग

वेब परिचय वेब एचटीएमएल वेब सीएसएस वेब जावास्क्रिप्ट वेब विन्यास वेब बैंड वेब खानपान वेब रेस्टोरेंट वेब आर्किटेक्ट

उदाहरण

W3.CSS उदाहरण W3.CSS डेमो W3.CSS टेम्पलेट्स

संदर्भ

W3.CSS संदर्भ W3.CSS डाउनलोड

W3.CSS स्लाइड शो


कैप्शन टेक्स्ट

मैनुअल स्लाइड शो

W3.CSS के साथ मैन्युअल स्लाइड शो प्रदर्शित करना बहुत आसान है।

बस एक ही वर्ग के नाम के साथ कई तत्व बनाएं:

उदाहरण

<img class="mySlides" src="img_snowtops.jpg">
<img class="mySlides" src="img_lights.jpg">
<img class="mySlides" src="img_mountains.jpg">
<img class="mySlides" src="img_forest.jpg">

और छवियों को स्क्रॉल करने के लिए दो बटन:

उदाहरण

<button class="w3-button w3-display-left" onclick="plusDivs(-1)">&#10094;</button>
<button class="w3-button w3-display-right" onclick="plusDivs(+1)">&#10095;</button>

और छवियों का चयन करने के लिए एक जावास्क्रिप्ट जोड़ें:

उदाहरण

var slideIndex = 1;
showDivs(slideIndex);

function plusDivs(n) {
  showDivs(slideIndex += n);
}

function showDivs(n) {
  var i;
  var x = document.getElementsByClassName("mySlides");
  if (n > x.length) {slideIndex = 1}
  if (n < 1) {slideIndex = x.length} ;
  for (i = 0; i < x.length; i++) {
    x[i].style.display = "none";
  }
  x[slideIndex-1].style.display = "block";
}

जावास्क्रिप्ट समझाया

सबसे पहले, स्लाइडइंडेक्स को 1 पर सेट करें। (पहली तस्वीर)

फिर पहली छवि प्रदर्शित करने के लिए showDivs() को कॉल करें।

जब उपयोगकर्ता किसी एक बटन पर क्लिक करता है तो plusDivs() को कॉल करें ।

The plusDivs() function subtracts one or  adds one to the slideIndex.

The showDiv() function hides (display="none") all elements with the class name "mySlides", and displays (display="block") the element with the given slideIndex.

If the slideIndex is higher than the number of elements (x.length), the slideIndex is set to zero.

If the slideIndex is less than 1 it is set to number of elements (x.length).



Automatic Slideshow

To display an automatic slideshow is even simpler.

You only need a little different JavaScript:

Example

var slideIndex = 0;
carousel();

function carousel() {
  var i;
  var x = document.getElementsByClassName("mySlides");
  for (i = 0; i < x.length; i++) {
    x[i].style.display = "none";
  }
  slideIndex++;
  if (slideIndex > x.length) {slideIndex = 1}
  x[slideIndex-1].style.display = "block";
  setTimeout(carousel, 2000); // Change image every 2 seconds
}

HTML Slides

The slides do not have to be images.

They can be any HTML content:

Slide 2

Lorem ipsum

Example

<div class="mySlides">
  <div class="w3-container w3-red">
    <h1><b>Did You Know?</b></h1>
    <h1><i>We plan to sell trips to the moon in the 2020s</i></h1>
  </div>
</div>

Slideshow Caption

Snow, Norway

Add a caption text for each image slide with the w3-display-* classes (topleft, topmiddle, topright, bottomleft, bottommiddle, bottomright, left, right or middle):

Example

<div class="w3-display-container mySlides">
  <img src="img_snowtops.jpg" style="width:100%">
  <div class="w3-display-bottomleft w3-container w3-padding-16 w3-black">
    French Alps
  </div>
</div>

Slideshow Indicators

An example of using buttons to indicate how many slides there are in the slideshow, and which slide the user is currently viewing.

Example

<div class="w3-center">
  <button class="w3-button" onclick="plusDivs(-1)">&#10094; Prev</button>
  <button class="w3-button" onclick="plusDivs(1)">Next &#10095;</button>

  <button class="w3-button demo" onclick="currentDiv(1)">1</button>
  <button class="w3-button demo" onclick="currentDiv(2)">2</button>
  <button class="w3-button demo" onclick="currentDiv(3)">3</button>
</div>

Another example:

Example

<div class="w3-content w3-display-container">
  <img class="mySlides" src="img_nature.jpg">
  <img class="mySlides" src="img_snowtops.jpg">
  <img class="mySlides" src="img_mountains.jpg">
  <div class="w3-center w3-display-bottommiddle" style="width:100%">
    <div class="w3-left" onclick="plusDivs(-1)">&#10094;</div>
    <div class="w3-right" onclick="plusDivs(1)">&#10095;</div>
    <span class="w3-badge demo w3-border" onclick="currentDiv(1)"></span>
    <span class="w3-badge demo w3-border" onclick="currentDiv(2)"></span>
    <span class="w3-badge demo w3-border" onclick="currentDiv(3)"></span>
  </div>
</div>

Images as Indicators

An example of using images as indicators:

Example

<div class="w3-content" style="max-width:1200px">
  <img class="mySlides" src="img_nature_wide.jpg" style="width:100%">
  <img class="mySlides" src="img_snow_wide.jpg" style="width:100%">
  <img class="mySlides" src="img_mountains_wide.jpg" style="width:100%">

  <div class="w3-row-padding w3-section">
    <div class="w3-col s4">
      <img class="demo w3-opacity" src="img_nature_wide.jpg"
      style="width:100%" onclick="currentDiv(1)">
    </div>
    <div class="w3-col s4">
      <img class="demo w3-opacity" src="img_snow_wide.jpg"
      style="width:100%;display:none" onclick="currentDiv(2)">
    </div>
    <div class="w3-col s4">
      <img class="demo w3-opacity" src="img_mountains_wide.jpg"
      style="width:100%;display:none" onclick="currentDiv(3)">
    </div>
  </div>
</div>

Multiple Slideshows on the Same Page

To operate multiple slideshows on one page, you must class the members of each slideshow group with different classes:

Example

<div class="w3-content">
<img class="mySlides1" src="img_snowtops.jpg" style="width:100%">
<img class="mySlides1" src="img_lights.jpg" style="width:100%">
<img class="mySlides1" src="img_mountains.jpg" style="width:100%">
<img class="mySlides1" src="img_forest.jpg" style="width:100%">
</div>

<div class="w3-content">
<img class="mySlides2" src="img_la.jpg" style="width:100%">
<img class="mySlides2" src="img_ny.jpg" style="width:100%">
<img class="mySlides2" src="img_chicago.jpg" style="width:100%">
</div>

Animated Slides

Slide or fade in an element from the top, bottom, left or right of the screen with the w3-animate-* classes.

Example

<img class="mySlides w3-animate-top"    src="img_01.jpg">
<img class="mySlides w3-animate-bottom" src="img_02.jpg">
<img class="mySlides w3-animate-top"    src="img_03.jpg">
<img class="mySlides w3-animate-bottom" src="img_04.jpg">

Faded Animation

The w3-animate-fading class fades an element in and out (takes about 10 seconds).

Example

<img class="mySlides w3-animate-fading" src="img_01.jpg">
<img class="mySlides w3-animate-fading" src="img_02.jpg">
<img class="mySlides w3-animate-fading" src="img_03.jpg">
<img class="mySlides w3-animate-fading" src="img_04.jpg">