首页banner的酷炫效果多来自全屏大图的幻灯片动画,下面提供一种完美兼容的jquery动画特效:全新jquery多点滑动幻灯片——全屏动画animateSlide(代码完全原创)。

直接上代码,把html、css和jquery代码copy到页面上即可呈现完美画面。

html代码如下:

<div class="animateSlide">
<div class="animateSlideImgWrap">
<div class="animateSlideImgBox present">
<p class="text1">亲,这是第一行标题</p>
<p class="text2">AAAAAAAAAAAAAAAAAAAAA</p>
<!--<img class="img" alt="" src="img/1.png" />-->
<div class="img" style="width: 500px; height: 390px; background: #ffaeae; opacity: 0.6;"></div><!-- 实际项目中用上面注释的半透明png图片,目前临时用div代替图片 -->
</div>
<div class="animateSlideImgBox">
<p class="text1">亲,这是一行宣传语</p>
<p class="text2">BBBBBBBBBBBBBBBBBBBBB</p>
<!--<img class="img" alt="" src="img/2.png" />-->
<div class="img" style="width: 500px; height: 390px; background: #aeffb2; opacity: 0.6;"></div><!-- 实际项目中用上面注释的半透明png图片,目前临时用div代替图片 -->
</div>
<div class="animateSlideImgBox">
<p class="text1">亲,这是一个奇迹啊</p>
<p class="text2">CCCCCCCCCCCCCCCCCCCCC</p>
<!--<img class="img" alt="" src="img/3.png" />-->
<div class="img" style="width: 500px; height: 390px; background: #aebdff; opacity: 0.6;"></div><!-- 实际项目中用上面注释的半透明png图片,目前临时用div代替图片 -->
</div>
</div>
<div class="animateSlideBtnL">&lt;</div>
<div class="animateSlideBtnR">&lt;</div>
</div>

css代码如下:

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

jquery代码如下:

(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(".animateSlideBtnL, .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.find(".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").css("left", (widthWin - 980) / 2 + "px");
_imgBoxCur.find(".img").css("left", (widthWin - 980) / 2 + 470 + "px");
_btnR.on("click", function() {
animateSlideFn();
});
_btnL.on("click", function() {
animateSlideFn();
});
start = setTimeout(function() {
animateSlideFn();
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"))) {
//当前帧动画
_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);
//下一帧动画
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
});
});

全新jquery多点滑动幻灯片——全屏动画animateSlide的更多相关文章

  1. 基于js全屏动画焦点图幻灯片

    今天给大家分享一款基于js全屏动画焦点图幻灯片.这款焦点图内的内容以动画形式出现和消失.效果图如下: 在线预览   源码下载 实现的代码. html代码: <div class="sl ...

  2. JS框架_(JQuery.js)文章全屏动画切换

    百度云盘 传送门 密码:anap 文章全屏动画切换效果 <!doctype html> <html lang="zh"> <head> < ...

  3. jQuery鼠标滚动垂直全屏切换代码

    体验效果:http://hovertree.com/texiao/jquery/68/ 源码下载:http://hovertree.com/h/bjaf/f643upc4.htm 代码如下: < ...

  4. 如何给PDF设置全屏动画

    PPT文件可以播放全屏,并且可以实现飞入.分割.闪烁等动画模式播放.那么PDF文件可以吗?我们想要给PDF文件加入动画效果应该怎么做呢,也有很多的小伙伴不知道该怎么把PDF文件切换为全屏动画模式想要知 ...

  5. 基于jQuery带进度条全屏图片轮播代码

    基于jQuery带进度条全屏图片轮播代码.这是一款基于jQuery实现的oppo手机官网首页带进度条全屏图片轮播特效.效果图如下: 在线预览   源码下载 实现的代码. html代码: <div ...

  6. ios滑动手势全屏(这段代码实现了下一级控制器滑到上一级控制器)

    在自定义导航控制器里面加以下代码就增加全屏滑动手势 >推向前一个控制器 //  HBNavigationController.m // #import "HBNavigationCon ...

  7. MyEclipse9中的不伤眼修改、FreeMarker插件、JQuery提示插件、全屏(FullScreen)插件的安装

    ============下载相关附件===================== http://files.cnblogs.com/fhtwins/eclipse-fullscreen_1.0.7.zi ...

  8. jQuery支持mobile的全屏水平横向翻页效果

    这是一款支持移动手机mobile设备的jQuery全屏水平横向翻页效果插件. 该翻页插件能够使页面在水平方向上左右全屏翻动,它支持手机触摸屏,支持使用鼠标滚动页面. 整个页面过渡平滑,效果很不错. 在 ...

  9. JQuery之滑动幻灯片插件Easy Slider初体验

    Easy Slider 是一个滑动幻灯片插件,支持任何图片或内容,可以实现横向或纵向滑动.它拥有一系列丰富的参数设置,可通过CSS来进行完全的控制.基本上只需要引入这个插件后,设置好内容,然后样式化C ...

随机推荐

  1. PostgreSQL停止动作观察

    实验过程如下: 启动一个客户端: [postgres@cnrd56 bin]$ ./psql psql () Type "help" for help. postgres=# be ...

  2. Codeforces Beta Round #12 (Div 2 Only) D. Ball sort/map

    D. Ball Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/12/D D ...

  3. 【JavaScript】谈谈Google Polymer以及Web UI框架的未来

    摘要:开发者Axel Rauschmayer在自己的博客上详解了Google Polymer的设计理念与组成架构,深得Polymer开发者的认同.他认为Polymer这样高互操作性的设计才应该是Web ...

  4. change netbeans look and feel

    change netbeans look and feel: 方法一: 下载地址:https://kenai.com/projects/nbsubstance/downloads/directory/ ...

  5. 强大的ASP.NET控件---验证控件

        学习完了牛腩之后,在进行ASP.NET的学习的时候,对全部学的知识.都有一种似曾相识的感觉,"哦,这个,在牛腩新闻公布系统中用过".仅仅只是那时候.用的也是迷迷糊糊的,就说 ...

  6. C#对Windows服务的操作

    一.安装服务: private void InstallService(IDictionary stateSaver, string filepath) { try { System.ServiceP ...

  7. Ubantu下FTP服务器资源进行控制

    在FTP服务器的管理中无论对本地用户还是匿名用户,对于FTP服务器资源的使用都需要进行控控制, 避免由于负担过大造成FTP服务器运行异常, 可以添加以下配置项对FTP客户机使用FTP服务器资源进行控制 ...

  8. 基于ARM-LINUX的温度传感器驱动-DS18B20

    转载:http://blog.csdn.net/ayangke/article/details/6883244 作者:冯建,华清远见嵌入式学院讲师. DS18B20数字温度传感器接线方便,封装成后可应 ...

  9. Linux下mv命令详解

    mv命令格式:mv [选项] 源文件或目录 目标文件或目录 mv命令参数(选项): -b :若需覆盖文件,则覆盖前先行备份. -f :force 强制的意思,如果目标文件已经存在,不会询问而直接覆盖: ...

  10. ASP.NET MVC与WebForm区别

    [转贴一] 使用ASP.NET MVC框架,创建默认项目,第一直观感觉就是地址都是Rewrite过的.对源码和配置文件稍加分析不难看出,MVC使用了httpModules来拦截地址请求,具体用到了Sy ...