jquery implementation photo without trigger swipe

Source: Internet
Author: User

Because it is a novice, so when the photo album slide, just at the beginning of the situation will only be triggered to achieve the photo slide. Even with the setinterval () function, a similar function, such as Click (), must be added to trigger the left or right arrows for automatic sliding.

So how do you make a photo slide automatically without triggering any labels?

First look at the properties of the SetInterval () function: SetInterval (code,millisec[, "Lang"])

This definition of setinterval:

The SetInterval () method invokes a function or evaluates an expression according to the specified period (in milliseconds).

The SetInterval () method keeps calling functions until Clearinterval () is called or the window is closed. The ID value returned by SetInterval () can be used as a parameter to the Clearinterval () method.

Then, if you define a function, the function realizes the photo is displayed in turn, and then calls the function with SetInterval (), it should be possible to implement the automatic sliding of the photo without triggering.

Suppose a total of 4 photos, slide the class name of the Photo:

var I=1;

/* Define photo rotation function */
var slideauto=function () {
i++;
if (i==5) {i=1;};
$ (". Slide" +i). Show (). siblings (). Stop (). Hide ();
}

/* Call setinterval for no trigger slip */

var time=setinterval (slideauto,6000);

HTML Part code:

<div style= "position:relative;left:0;top:0;z-index:0;width:4000px;height:500px;" >




</div>

jquery implementation photo without trigger swipe

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.