Js achieves slideshow image effects that support mobile phone sliding Switching

Source: Internet
Author: User

Js achieves slideshow image effects that support mobile phone sliding Switching

This example describes how js achieves slideshow effects that support mobile phone slide switching. Share it with you for your reference. The details are as follows:

The running effect is as follows:

Click here to download the complete instance code.

Case study:

?

1

2

3

4

5

6

7

<Script type = "text/javascript" src = "../src/zepto. js"> </script>

<Script type = "text/javascript" src = "../src/carousel-image.js"> </script>

<Script>

$ ('. Usel-image'). cancuselimage ({

Num: $ ('. Invalid usel-num ')

});

</Script>

Or requirejs:

?

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

<Div class = "carousel-image">

<Div>

<A>

</A>

<A>

</A>

<A>

</A>

</Div>

<Div class = "carousel-num">

</Div>

</Div>

<Script type = "text/javascript" src = "../src/zepto. js"> </script>

<Script type = "text/javascript" src = "../src/require. js"> </script>

<Script>

Requirejs. config ({

// By default load any module IDs from js/lib

BaseUrl: '../src ',

Paths :{

$: 'Zepto'

}

});

Require (['usel-image', "$"], function (CarouselImage, $ ){

Var cs = new CarouselImage ();

Cs. init ({

Target: $ ('. usel-image '),

Num: $ ('. Invalid usel-num ')

});

});

</Script>

API attributes, methods, and callbacks:

Target:

It indicates that the element in the container will trigger the event. It should have a sub-level container to facilitate animation optimization.

Num:

The intention is to display the number of the current index, but now the number is hidden with the style, if you want to display the digital style, you can change the style File

I hope this article will help you design javascript programs.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.