To add plugin to a page, we need to download plugin.js file and also include jQuery Library to the script block of the page. Below example we are going to make a slideshow effect using cycle plugin. It provides different options to have different transition effects and layouts.
Example:
<html>
<head>
<title> adding plugin toa page </title>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.cycle/3.0.3/jquery.cycle.all.min.js"></script>
<script type="text/javascript">
(function ($) {
$(document).ready(function () {
$('.slider').cycle('fade');
});
})(jQuery);
</script>
<style type="text/css">
.slider img {
padding: 15px;
border: 1px solid #ccc;
background-color: #eee;
width: 500px;
height: 300px;
top: 0;
left: 0;
}
</style>
</head>
<body style="width: 600px">
<div class="slider">
<img src="images/hua001.jpg" alt="Beach 1" />
<img src="images/hua002.jpg" alt="Beach 2" />
<img src="images/hua003.jpg" alt="Beach 3" />
</div>
</body>
</html>
Output: