JQuery plug-in animateSlide creates multi-point slide slides _ jquery

Source: Internet
Author: User
This article will share with you how to use the jQuery plug-in animateSlide to create a multi-point slide effect. it is very cool. if you need a small partner, you can refer to banner's cool effect on the home page and mostly the slide animation from the full screen, the following provides a perfectly compatible jquery animation effect: the new jquery multi-point slide-full screen animation animateSlide (the code is completely original ).

Directly copy the html, css, and jquery code to the page to display the perfect picture.

The html code is as follows:

This is the first line of title

AAAAAAAAAAAAAAAAAAAAA

This is a publicity line.

Bbbbbbbbbbbbbbbbbbbbbbbbb

This is a miracle.

Ccccccccccccccccccc

<

<

The css code is as follows:

.animateSlide {width: 100%; height: 390px; position: relative; background: #f5f5f5;}.animateSlideImgWrap {width: 100%; height: 390px; position: absolute; z-index: 1; overflow: hidden;}.animateSlideImgWrap .present {display: block;}.animateSlideImgBox {width: 100%; height: 390px; position: absolute; z-index: 1; display: none;}.animateSlideImgBox .text1 {font-family: Microsoft YaHei; font-size: 36px; line-height: 1.2em; color: #384cd0; position: absolute; top: 120px; z-index: 3; white-space: nowrap;}.animateSlideImgBox .text2 {font-family: Microsoft YaHei; font-size: 26px; line-height: 1.2em; color: orange; position: absolute; top: 200px; z-index: 3; white-space: nowrap;}.animateSlideImgBox .img {position: absolute; left: 470px; top: 0; z-index: 2;}.animateSlideBtnL,.animateSlideBtnR {  width: 30px; height: 60px; line-height: 60px; font-size: 20px; font-weight: 700; text-align: center; background: #ddd;  position: absolute; left: 30px; top: 150px; z-index: 6; cursor: pointer; display: none;}.animateSlideBtnR {left: auto; right: 20px;}

The jquery code is as follows:

(Function ($) {$. fn. animateSlide = function (options) {var defaults = {btnL :". animateSlideBtnL ", btnR :". animateSlideBtnR ", imgBox :". animateSlideImgBox ", animateTime: 500, delayTime: 5000, density: 1}; var opts = $. extend (defaults, options); var widthWin = $ (window ). width (); $ (window ). resize (function () {widthWin = $ (window ). width () ;}); // this. on ("mouseenter", function () {$ (this ). find (". anim AteSlideBtnL ,. animateSlideBtnR "). stop (). fadeIn (400 );}). on ("mouseleave", function () {$ (this ). find (". animateSlideBtnL ,. animateSlideBtnR "). stop (). fadeOut (400) ;}); return this. each (function () {var _ this = $ (this); var _ btnL = _ this. find (opts. btnL); var _ btnR = _ this. find (opts. btnR); var _ imgBox = _ this. find (opts. imgBox); var _ imgBoxCur = _ imgBox. filter (". present "); var _ curText1 = _ imgBoxCur. fin D (". text1 "), _ curText2 = _ imgBoxCur. find (". text2 "), _ curImg = _ imgBoxCur. find (". img "); var _ imgBoxNext = null, _ nextText1 = null, _ nextText2 = null, _ nextImg = null; var index = _ imgBox. index (_ imgBoxCur) | 0; var size = _ imgBox. size (); var start = null; index ++; if (index> = size) {index = 0;} _ imgBoxNext = _ imgBox. eq (index); _ nextText1 = _ imgBoxNext. find (". text1 "); _ nextText2 = _ imgBoxNext. find (". Text2 "); _ nextImg = _ imgBoxNext. find (". img "); _ imgBox. find (". text1 ,. text2 ,. img ").css (" left ", widthWin); _ imgBoxCur. find (". text1 ,. text2 "2.16.css (" left ", (widthWin-980)/2 +" px "); _ imgBoxCur. find (". img "2.16.css (" left ", (widthWin-980)/2 + 470 +" px "); _ btnR. on ("click", function () {animateSlideFn () ;}); _ btnL. on ("click", function () {animateSlideFn () ;}); start = setTimeout (function () {anima TeSlideFn (); start = setTimeout (arguments. callee, opts. delayTime) ;}, opts. delayTime); function animateSlideFn () {if (! (_ ImgBoxCur. find (". text1 ,. text2 ,. img "). is (": animated") | _ imgBoxNext. find (". text1 ,. text2 ,. img "). is (": animated") {// Current frame animation _ curText1.animate ({left: parseInt(_curText1.css ("left") + 100}, opts. animateTime * 0.6, function () {_ curText1.animate ({left: "-510px"}, opts. animateTime) ;}); setTimeout (function () {_curtext2.animate ({left: parseInt(_curText2.css ("left") + 100}, opts. animateTime * 0.6, function () {_ curText2.animate ({left: "-510px"}, opts. animateTime) ;}) ;}, 200); setTimeout (function () {_ curImg. animate ({left: parseInt(_curImg.css ("left") + 200}, opts. animateTime * 0.6, function () {_ curImg. animate ({left: "-510px"}, opts. animateTime, function () {_ imgBox. find (". text1 ,. text2 ,. img ").css (" left ", widthWin); _ imgBoxCur. removeClass ("present") ;}) ;}, 400); // The next frame of the animation setTimeout (function () {_ imgBoxNext. addClass ("present"); _ nextText1.animate ({left: (widthWin-980)/2-100}, opts. animateTime, function () {_ nextText1.animate ({left: (widthWin-980)/2}, opts. animateTime * 0.6);}); setTimeout (function () {_ nextText2.animate ({left: (widthWin-980)/2-100}, opts. animateTime, function () {_ nextText2.animate ({left: (widthWin-980)/2}, opts. animateTime * 0.6);}, 200); setTimeout (function () {_ nextImg. animate ({left: (widthWin-980)/2 + 370}, opts. animateTime, function () {_ nextImg. animate ({left: (widthWin-980)/2 + 470}, opts. animateTime * 0.6, function () {index ++; if (index> = size) {index = 0;} _ imgBoxCur = _ imgBox. filter (". present "); _ imgBoxNext = _ imgBox. eq (index); _ curText1 = _ imgBoxCur. find (". text1 "); _ curText2 = _ imgBoxCur. find (". text2 "); _ curImg = _ imgBoxCur. find (". img "); _ nextText1 = _ imgBoxNext. find (". text1 "); _ nextText2 = _ imgBoxNext. find (". text2 "); _ nextImg = _ imgBoxNext. find (". img ") ;}) ;}, 400) ;}, opts. density * 1200) ;}}}) ;}}( jQuery) ;$ (function () {$ (". animateSlide "). animateSlide ({btnL :". animateSlideBtnL ", btnR :". animateSlideBtnR ", imgBox :". animateSlideImgBox ", animateTime: 500, delayTime: 6000, density: 0.9 });});

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.