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:
Post your comments / questions
Recent Article
- How to get domain name information from a Domain using Python
- ModulenotFoundError: no module named 'debug_toolbar' -SOLUTION
- How to create superuser in django project hosted in cPanel without terminal
- CSS & images not loading in django admin | cpanel without terminal
- Could not build wheels for mysqlclient, which is required to install pyproject.toml-based projects
- How to sell domain name on Godaddy (2023)
- TemplateSyntaxError at / Could not parse the remainder: ' + 1' from 'forloop.counter0 + 1'
- urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0
Related Article