Skip to main content
Participant
November 26, 2016
Answered

Slideshow Help! (Time Sensitive)

  • November 26, 2016
  • 1 reply
  • 1086 views

Hi.

I am a beginner in Dreamweaver and I am having trouble finding a slideshow that will work on my website. The one I am working with now won't show and it confuses me. Does anyone have a slideshow (preferably in HTML/CSS) that works well and is relatively simple to make? (If JavaScript is required, please be overly detailed about the process and where everything goes).

This is for a project that I need to have done by tomorrow. Any help would be greatly appreciated!

Katie

This topic has been closed for replies.
Correct answer Nancy OShea

Use jQuery Cycle2 which is one of the easiest to implement.  Copy & paste the following code into a new, blank document.  SaveAs test.html to preview in browsers.  For this to work, you need both jQuery and the Cycle2 plugin.

<!doctype html>

<html lang="en">

<head>

<meta charset="utf-8">

<title>HTML5 document with Cycle2</title>

<!--Latest jQuery Core Library-->

<script src="http://code.jquery.com/jquery-latest.min.js">

</script>

<!--Cycle2 Plugin Script-->

<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.cycle2/20130409/jquery.cycle2.min.js"></script>

<!--Cycle2 Carousel-->

<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.cycle2/20130409/jquery.cycle2.carousel.min.js"></script>

<!--Invoke Cycle2 function on page load-->

<script>$.fn.cycle.defaults.autoSelector = '.slideshow';</script>

<style>

* {

    -webkit-box-sizing: border-box;

    -moz-box-sizing: border-box;

    box-sizing: border-box;

    margin: 0;

    padding: 0;

}

body {width:90%; margin:0 auto; padding: 1.5%}

.slideshow img {

border:1px solid #999;

}

/* pager */

.cycle-pager {

    text-align: center;

    width: 100%;

    z-index: 500;

    position: relative;

    top: 0;

}

.cycle-pager span {

    font-family: arial;

    font-size: 75px;

    width: 22px;

    height: 22px;

    display: inline-block;

    color: #ddd;

    cursor: pointer;

}

.cycle-pager span.cycle-pager-active { color:#09C; }

.cycle-pager > * { cursor: pointer; }

</style>

</head>

<body>

<h1><a href="http://www.malsup.com/jquery/cycle2/">jQuery Cycle 2</a> Responsive Carousel Slideshow</h1>

<!--begin slideshow-->

<div class="slideshow"

data-cycle-pause-on-hover="true"

data-cycle-fx="carousel"

data-cycle-timeout="2000"

data-cycle-pager="#pager"

data-cycle-carousel-offset="2"

data-cycle-carousel-visible="3"

data-cycle-carousel-fluid="true"

>

<!--INSERT YOUR IMAGES HERE-->

<img alt="description" src="http://placehold.it/350x140/FFFFFF&text=image 1">

<img alt="description" src="http://placehold.it/350x140/000000&text=image 2">

<img alt="description" src="http://placehold.it/350x140/FFFFFF&text=image 3">

</div>

<div class="cycle-pager" id="pager"></div>

<!--end slideshow-->

</body>

</html>

For more options, consult the Cycle2 documentation.

Cycle2

Nancy.

1 reply

Nancy OShea
Community Expert
Nancy OSheaCommunity ExpertCorrect answer
Community Expert
November 26, 2016

Use jQuery Cycle2 which is one of the easiest to implement.  Copy & paste the following code into a new, blank document.  SaveAs test.html to preview in browsers.  For this to work, you need both jQuery and the Cycle2 plugin.

<!doctype html>

<html lang="en">

<head>

<meta charset="utf-8">

<title>HTML5 document with Cycle2</title>

<!--Latest jQuery Core Library-->

<script src="http://code.jquery.com/jquery-latest.min.js">

</script>

<!--Cycle2 Plugin Script-->

<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.cycle2/20130409/jquery.cycle2.min.js"></script>

<!--Cycle2 Carousel-->

<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.cycle2/20130409/jquery.cycle2.carousel.min.js"></script>

<!--Invoke Cycle2 function on page load-->

<script>$.fn.cycle.defaults.autoSelector = '.slideshow';</script>

<style>

* {

    -webkit-box-sizing: border-box;

    -moz-box-sizing: border-box;

    box-sizing: border-box;

    margin: 0;

    padding: 0;

}

body {width:90%; margin:0 auto; padding: 1.5%}

.slideshow img {

border:1px solid #999;

}

/* pager */

.cycle-pager {

    text-align: center;

    width: 100%;

    z-index: 500;

    position: relative;

    top: 0;

}

.cycle-pager span {

    font-family: arial;

    font-size: 75px;

    width: 22px;

    height: 22px;

    display: inline-block;

    color: #ddd;

    cursor: pointer;

}

.cycle-pager span.cycle-pager-active { color:#09C; }

.cycle-pager > * { cursor: pointer; }

</style>

</head>

<body>

<h1><a href="http://www.malsup.com/jquery/cycle2/">jQuery Cycle 2</a> Responsive Carousel Slideshow</h1>

<!--begin slideshow-->

<div class="slideshow"

data-cycle-pause-on-hover="true"

data-cycle-fx="carousel"

data-cycle-timeout="2000"

data-cycle-pager="#pager"

data-cycle-carousel-offset="2"

data-cycle-carousel-visible="3"

data-cycle-carousel-fluid="true"

>

<!--INSERT YOUR IMAGES HERE-->

<img alt="description" src="http://placehold.it/350x140/FFFFFF&text=image 1">

<img alt="description" src="http://placehold.it/350x140/000000&text=image 2">

<img alt="description" src="http://placehold.it/350x140/FFFFFF&text=image 3">

</div>

<div class="cycle-pager" id="pager"></div>

<!--end slideshow-->

</body>

</html>

For more options, consult the Cycle2 documentation.

Cycle2

Nancy.

Nancy O'Shea— Product User & Community Expert
Participant
November 27, 2016

Thank you so much! I have two questions.

1) Can you explain to me how I get the jQuery and Cycle2 plugins? 2) Just to clarify (I'm really tired), this is all in a new HTML document?

Katie

Nancy OShea
Community Expert
Community Expert
November 27, 2016

1) You don't need to GET them.  They are conveniently hosted on content distribution networks (CDNs) for everyone to use and access.  You need only include those links in your documents as I have shown.

2) Copy & paste the entire code I gave you into a new, blank document and save it.

That's all you need for a slideshow.

If you want to combine the slideshow with other source code, follow the same structure.

  • Scripts and CSS code goes in the <head> tag.
  • Content goes in the <body> tag.

Nancy O

Nancy O'Shea— Product User & Community Expert