Home Web Front-end JS Tutorial jQuery creates responsive image carousel effect

jQuery creates responsive image carousel effect

Apr 25, 2018 am 10:31 AM
jquery picture Effect

This time I will bring you jQuery to create a responsive image carousel effect. What are the precautions for jQuery to create a responsive image carousel effect? ​​Here are practical cases, let’s take a look.

The screenshot of the running effect is as follows:

mislider is a very cool jQuery responsive circular image carousel special effects plug-in, mislider carousel The features of the plug-in are:

  • Easy to use

  • Supports multiple carousels on the same screen

  • The content of the carousel can be a single image or complex HTML content

  • Lightweight

  • Responsive design

  • Very easy to customize

  • Rich Callback function

  • Cross-browsing browser, supports IE8 browser

Introduce core files
mislider plug-in depends on some plug-ins, you must first introducejQuery , html5shiv.js, mislider.min.js and mislider.min.css, mislider-custom.css file.

1

2

3

4

5

<link href="css/mislider.css" rel="stylesheet">

<link href="css/mislider-custom.css" rel="stylesheet">

<script src="../lib/html5shiv/html5shiv.js"></script>

<script src="js/jquery.min.js"></script>

<script src="js/mislider.js"></script>

Copy after login

Build html

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

<ol class="mis-slider">

   <!-- slider 元素 - class是一个参数选项 -->

   <li class="mis-slide">

    <!-- 一个旋转元素 - class是一个参数选项 -->

    <a href="#" class="mis-container">

     <!-- A slide container - this element is optional, if absent the plugin adds it automatically -->

     <figure>

      <!-- Slide content - whatever you want -->

      <img src="images/garden01.jpg" alt="Pink Water Lillies">

      <figcaption>Pink Water Lillies</figcaption>

     </figure>

    </a>

   </li>

   <li class="mis-slide">

    <a href="#" class="mis-container">

     <figure>

      <img src="images/garden02.jpg" alt="Pond with Lillies">

      <figcaption>Pond with Lillies</figcaption>

     </figure>

    </a>

   </li>

 </ol>

Copy after login

Note: The above classes are not necessary. If you do not write these classes, the plug-in will automatically add classes to the corresponding elements. By default, the carousel plug-in uses an ordered list structure. If you use a different element structure, make sure to modify the selectorSlider and selectorSlide options.

WriteJSInitialize the plug-in

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

jQuery(function ($) {

   var slider = $('.mis-stage').miSlider({

    // The height of the stage in px. Options: false or positive integer. false = height is calculated using maximum slide heights. Default: false

    stageHeight: 380,

    // Number of slides visible at one time. Options: false or positive integer. false = Fit as many as possible. Default: 1

    slidesOnStage: false,

    // The location of the current slide on the stage. Options: 'left', 'right', 'center'. Defualt: 'left'

    slidePosition: 'center',

    // The slide to start on. Options: 'beg', 'mid', 'end' or slide number starting at 1 - '1','2','3', etc. Defualt: 'beg'

    slideStart: 'mid',

    // The relative percentage scaling factor of the current slide - other slides are scaled down. Options: positive number 100 or higher. 100 = No scaling. Defualt: 100

    slideScaling: 150,

    // The vertical offset of the slide center as a percentage of slide height. Options: positive or negative number. Neg value = up. Pos value = down. 0 = No offset. Default: 0

    offsetV: -5,

    // Center slide contents vertically - Boolean. Default: false

    centerV: true,

    // Opacity of the prev and next button navigation when not transitioning. Options: Number between 0 and 1. 0 (transparent) - 1 (opaque). Default: .5

    navButtonsOpacity: 1

   });

  });

Copy after login

Note: Make sure to .mis-stage the jQuery selector and the carousel container in the HTML page The class names are the same.
Parameters

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

 jQuery(function ($) {

   var slider = $('.mis-stage').miSlider({

    // 轮播图过渡动画的速度 

    // 单位毫秒. Options: positive integer.

    speed: 700,

    // 轮播图在两个过渡动画之间的暂停时间 

    // in milliseconds. Options: false, positive integer. 

    // false = Autoplay off,设为false则不自动播放.

    pause: 4000,

    // 轮播图的增量 

    // Autoplay and Nav Buttons. 自动播放与导航按钮 

    // Options: positive or negative integer. 

    // Positive integer = Slide left. 正数向左

    // Negative integer = Slide right. 负数向右

    increment: 1,

    // 轮播图的高度 

    // Options: false or positive integer. 值:false或正整数

    // false = height is calculated using 设为false自动计算高度

    // maximum slide heights.最大高度

    stageHeight: false,

    // 同时在屏幕上可见的轮播图图片数量

    // Options: false or positive integer. 值:false或正整数

    // false = Fit as many as possible. false为自适应

    slidesOnStage: 1,

    // 连续运动-轮播图在同一个方向上无限循环 

    // true = slides loop in one direction if possible.

    slidesContinuous: true,

    // 当前轮播图在屏幕上的位置:left, center, right 

    // Options: 'left', 'right', 'center'.

    slidePosition: 'left',

    // 轮播图开始播放的位置. 

    // Options: 'beg', 'mid', 'end' 

    // or slide number starting at 1 - '1','2', etc.

    slideStart: 'beg',

    // 当前slide的宽度,单位px 

    // Options: false or positive integer. 值:false或正整数

    // false = width is the maximum of 设为false时为最大宽度

    // the existing slide widths.

    slideWidth: false,

    // 当前slide的缩放因子-其它图片会相应缩小

    // of the current slide

    // other slides are scaled down. 

    // Options: positive number 100 or higher. 

    // 100 = No scaling.

    slideScaling: 100,

    // slide的垂直偏移

    // as a percentage of slide height. 

    // Options: positive or negative number. 

    // Neg value = up. Pos value = down. 

    // 0 = No offset.

    offsetV: 0,

    // slide中的内容垂直居中

    // Boolean.

    centerV: false,

    // 原点导航按钮是否可用

    // Boolean.

    navList: true,

    // 箭头导航按钮是否可用

    // Boolean.

    navButtons: true,

    // 箭头导航一直显示

    // except when transitioning - Boolean.

    navButtonsShow: false,

    // 箭头导航按钮的透明度 

    // button navigation when not transitioning. 

    // Options: Number between 0 and 1. 

    // 0 (transparent) - 1 (opaque).

    navButtonsOpacity: 0.5,

    // 轮播图随机顺序

    // Boolean.

    randomize: false,

    // 轮播图加载后的回调函数

    // called when slides have loaded.

    slidesLoaded: false,

    // 轮播图过渡动画前的回调函数

    // call back function - called before 

    // the slide transition.

    beforeTrans: false,

    // 轮播图过渡动画完成之后的回调函数

    // call back function - called at the end 

    // of a slide transition.

    afterTrans: false,

    // Stage元素上的class名称

    // to the stage element.

    classStage: 'mis-stage',

    // The CSS class that will be Slider元素上的class名称

    // applied to the slider element.

    classSlider: 'mis-slider',

    // The CSS class that will be 每一个Slide元素上的class名称

    // applied to each slide element.

    classSlide: 'mis-slide',

    // The CSS class that will be 箭头导航按钮元素上的class名称

    // applied to the parent of the 

    // prev and next button navigation elements.

    classNavButtons: 'mis-nav-buttons',

    // The CSS class that will be 圆点导航按钮上的class名称

    // applied to the parent of the 

    // numbered list navigation elements

    classNavList: 'mis-nav-list',

    // The selector used to select 用于选择轮播图的选择器

    // the slider element

    // Descendant of the stage

    selectorSlider: 'ol',

    // The selector used to select 用于选择每一个Slide的选择器

    // each slide element

    // Descendant of the slider

    selectorSlide: 'li'

   });

  });

Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Detailed explanation of JS JQuery dynamic operation table row method

jQuery implementation of text button special effects collection in the form

The above is the detailed content of jQuery creates responsive image carousel effect. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1663
14
PHP Tutorial
1266
29
C# Tutorial
1238
24
Users encounter rare glitches: Samsung Watch smartwatches suddenly experience white screen issues Users encounter rare glitches: Samsung Watch smartwatches suddenly experience white screen issues Apr 03, 2024 am 08:13 AM

You may have encountered the problem of green lines appearing on the screen of your smartphone. Even if you have never seen it, you must have seen related pictures on the Internet. So, have you ever encountered a situation where the smart watch screen turns white? On April 2, CNMO learned from foreign media that a Reddit user shared a picture on the social platform, showing the screen of the Samsung Watch series smart watches turning white. The user wrote: "I was charging when I left, and when I came back, it was like this. I tried to restart, but the screen was still like this during the restart process." Samsung Watch smart watch screen turned white. The Reddit user did not specify the smart watch. Specific model. However, judging from the picture, it should be Samsung Watch5. Previously, another Reddit user also reported

How to solve the problem of automatically saving pictures when publishing on Xiaohongshu? Where is the automatically saved image when posting? How to solve the problem of automatically saving pictures when publishing on Xiaohongshu? Where is the automatically saved image when posting? Mar 22, 2024 am 08:06 AM

With the continuous development of social media, Xiaohongshu has become a platform for more and more young people to share their lives and discover beautiful things. Many users are troubled by auto-save issues when posting images. So, how to solve this problem? 1. How to solve the problem of automatically saving pictures when publishing on Xiaohongshu? 1. Clear the cache First, we can try to clear the cache data of Xiaohongshu. The steps are as follows: (1) Open Xiaohongshu and click the &quot;My&quot; button in the lower right corner; (2) On the personal center page, find &quot;Settings&quot; and click it; (3) Scroll down and find the &quot;Clear Cache&quot; option. Click OK. After clearing the cache, re-enter Xiaohongshu and try to post pictures to see if the automatic saving problem is solved. 2. Update the Xiaohongshu version to ensure that your Xiaohongshu

How to post pictures in TikTok comments? Where is the entrance to the pictures in the comment area? How to post pictures in TikTok comments? Where is the entrance to the pictures in the comment area? Mar 21, 2024 pm 09:12 PM

With the popularity of Douyin short videos, user interactions in the comment area have become more colorful. Some users wish to share images in comments to better express their opinions or emotions. So, how to post pictures in TikTok comments? This article will answer this question in detail and provide you with some related tips and precautions. 1. How to post pictures in Douyin comments? 1. Open Douyin: First, you need to open Douyin APP and log in to your account. 2. Find the comment area: When browsing or posting a short video, find the place where you want to comment and click the &quot;Comment&quot; button. 3. Enter your comment content: Enter your comment content in the comment area. 4. Choose to send a picture: In the interface for entering comment content, you will see a &quot;picture&quot; button or a &quot;+&quot; button, click

How to make ppt pictures appear one by one How to make ppt pictures appear one by one Mar 25, 2024 pm 04:00 PM

In PowerPoint, it is a common technique to display pictures one by one, which can be achieved by setting animation effects. This guide details the steps to implement this technique, including basic setup, image insertion, adding animation, and adjusting animation order and timing. Additionally, advanced settings and adjustments are provided, such as using triggers, adjusting animation speed and order, and previewing animation effects. By following these steps and tips, users can easily set up pictures to appear one after another in PowerPoint, thereby enhancing the visual impact of the presentation and grabbing the attention of the audience.

6 Ways to Make Pictures Sharper on iPhone 6 Ways to Make Pictures Sharper on iPhone Mar 04, 2024 pm 06:25 PM

Apple's recent iPhones capture memories with crisp detail, saturation and brightness. But sometimes, you may encounter some issues that may cause the image to look less clear. While autofocus on iPhone cameras has come a long way, allowing you to take photos quickly, the camera can mistakenly focus on the wrong subject in certain situations, making the photo blurry in unwanted areas. If your photos on your iPhone look out of focus or lack sharpness overall, the following post should help you make them sharper. How to Make Pictures Clearer on iPhone [6 Methods] You can try using the native Photos app to clean up your photos. If you want more features and options

What should I do if the images on the webpage cannot be loaded? 6 solutions What should I do if the images on the webpage cannot be loaded? 6 solutions Mar 15, 2024 am 10:30 AM

Some netizens found that when they opened the browser web page, the pictures on the web page could not be loaded for a long time. What happened? I checked that the network is normal, so where is the problem? The editor below will introduce to you six solutions to the problem that web page images cannot be loaded. Web page images cannot be loaded: 1. Internet speed problem The web page cannot display images. It may be because the computer's Internet speed is relatively slow and there are more softwares opened on the computer. And the images we access are relatively large, which may be due to loading timeout. As a result, the picture cannot be displayed. You can turn off the software that consumes more network speed. You can go to the task manager to check. 2. Too many visitors. If the webpage cannot display pictures, it may be because the webpages we visited were visited at the same time.

Kyushu Fengshen Assassin 4S Radiator Review Air-cooled 'Assassin Master' Style Kyushu Fengshen Assassin 4S Radiator Review Air-cooled 'Assassin Master' Style Mar 28, 2024 am 11:11 AM

Speaking of ASSASSIN, I believe players will definitely think of the master assassins in "Assassin's Creed". They are not only skilled, but also have the creed of "devoting themselves to the darkness and serving the light". The ASSASSIN series of flagship air-cooled radiators from the appliance brand DeepCool coincide with each other. Recently, the latest product of this series, ASSASSIN4S, has been launched. "Assassin in Suit, Advanced" brings a new air-cooling experience to advanced players. The appearance is full of details. The Assassin 4S radiator adopts a double tower structure + a single fan built-in design. The outside is covered with a cube-shaped fairing, which has a strong overall sense. It is available in white and black colors to meet different colors. Tie

How to arrange two pictures side by side in wps document How to arrange two pictures side by side in wps document Mar 20, 2024 pm 04:00 PM

When using WPS office software, we found that not only one form is used, tables and pictures can be added to the text, pictures can also be added to the table, etc. These are all used together to make the content of the entire document look richer. , if you need to insert two pictures into the document and they need to be arranged side by side. Our next course can solve this problem: how to place two pictures side by side in a wps document. 1. First, you need to open the WPS software and find the picture you want to adjust. Left-click the picture and a menu bar will pop up, select &quot;Page Layout&quot;. 2. Select &quot;Tight wrapping&quot; in text wrapping. 3. After all the pictures you need are confirmed to be set to &quot;Tight text wrapping&quot;, you can drag the pictures to the appropriate position and click on the first picture.

See all articles