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
- Import "django.shortcuts" could not be resolved from source in Django Project
- How to add two numbers in Android Studio? | Source Code
- FindViewByID returns null in android studio -SOLVED
- Saving changes is not permitted in SQL SERVER - [SOLVED]
- Restore of database failed. File cannot be restored over the existing. -[SOLVED]
- One or more projects in the solution were not loaded correctly in Visual Studio 2019 | FIXED
- How to find Laptop's Battery Health?
- SOLVED-Related Field got invalid lookup: icontains error in Django
Related Article