jQuery plugin : bgStretcher 背景图片切换效果插件
转自:http://blog.dvxj.com/pandola/jQuery_bgStretcher.html
bgStretcher 2011 (Background Stretcher)是一个jQuery的插件,可以为你的网页添加多张背景图,且多个背景图能够自动切换,同时背景图大小可以自适应浏览器窗口的大小。背景图的切换效果有淡入淡出,滚动,幻灯,其中选用滚动和幻灯时,可以选择方向,上下左右,或者左上右下,右上左下。图片切换顺序也可以设置正向,反向或者随机。更多选项就看你自己慢慢研究了。 插件特点:
1 |
<link rel="stylesheet" type="text/css" href="./main.css" /> |
2 |
<link rel="stylesheet" type="text/css" href="../bgstretcher.css" /> |
3 |
<script type="text/javascript" src="../jquery-1.5.2.min.js"></script> |
4 |
<script type="text/javascript" src="../bgstretcher.js"></script> |
接着把下面的代码,插入到上面代码之后,来初始化 bgStretcher 插件,要告知插件在哪个元素上起作用,同时可以配置插件的选项。同样,注意代码中的图片路径不要出错。
01 |
<script type="text/javascript"> |
02 |
$(document).ready(function(){ |
03 |
|
04 |
// Initialize Backgound Stretcher |
05 |
$('.demoo').bgStretcher({ |
06 |
images: ['images/sample-1.jpg', 'images/sample-2.jpg', 'images/sample-3.jpg', 'images/sample-4.jpg', 'images/sample-5.jpg', 'images/sample-6.jpg'], |
07 |
imageWidth: 800, |
08 |
imageHeight: 400, |
09 |
slideDirection: 'N', |
10 |
slideShowSpeed: 1000, |
11 |
transitionEffect: 'fade', |
12 |
sequenceMode: 'normal', |
13 |
}); |
14 |
|
15 |
}); |
16 |
</script> |
| 配置选项 | 缺 省 值 | 选项说明 |
|---|---|---|
| imageContainer | bgstretcher | bgStretcher will automatically build structure for the images list in a DOM tree. This parameter is ID for the images holder. Try inspecting the tree with a FireBug to get an idea how it's constructed. |
| resizeProportionally | true | Indicates if background image(s) will be resized proportionally or not. |
| resizeAnimate | false | Indicates if background image(s) will be resized with animation. (Be careful, this may slow down some PCs if your images are large.) |
| images | empty | An array containing list of images to be displayed on page's background. |
| imageWidth | 1024 | Original image's width. |
| imageHeight | 768 | Original image's height. |
| maxWidth | auto | Maximum image's width. |
| maxHeight | auto | Maximum image's height. |
| nextSlideDelay | 3000 (3 seconds) | Numeric value in milliseconds. The parameter sets delay until next slide should start. |
| slideShowSpeed | normal | Numeric value in milliseconds or jQuery string value ('fast', 'normal', 'slow'). The parameter sets the speed of transition between images. |
| slideShow | true | Allows or disallows slideshow functionality. |
| transitionEffect | fade | Transition effect (use also: none, simpleSlide, superSlide). |
| slideDirection | N | Slide Diraction: N – north, S – south, W – west, E – East (if transitionEffect = superSlide use also: NW, NE, SW, SE). |
| sequenceMode | normal | Sequence mode (use also: back, random) |
| buttonPrev | empty | Previous button CSS selector |
| buttonNext | empty | Next button CSS selector |
| pagination | empty | CSS selector for pagination |
| anchoring | 'left top' | Anchoring bgStrtcher area regarding window |
| anchoringImg | 'left top' | Anchoring images regarding window |
| preloadImg | false | For Preload images use true |
| stratElementIndex | 0 | Start element index |
| callbackfunction | null | Name of callback function |
插件方法:
| 方法名称 | 方法说明 |
|---|---|
| $(objID).bgStretcher.play() | Resume background slideshow |
| $(objID).bgStretcher.pause() | Pause background slideshow |
| $(objID).bgStretcher.sliderDestroy() | Destroy background slideshow |
原文在这里,俺稍微翻译了一下,演示效果俺自己调整了参数。 http://www.ajaxblender.com/bgstretcher-2-jquery-stretch-background-plugin-updated.html
jQuery plugin : bgStretcher 背景图片切换效果插件的更多相关文章
- 10款好用的 jQuery 图片切换效果插件
jQuery 是一个非常优秀的 Javascript 框架,使用简单灵活,同时还有许多成熟的插件可供选择.其中,最令人印象深刻的应用之一就是对图片的处理,它可以让帮助你在你的项目中加入一些让人惊叹的效 ...
- 100种不同图片切换效果插件pageSwitch
分享100种不同图片切换效果插件pageSwitch.这是一款适用于全屏切换场景,即一切一屏,并且实现了超过一百种切换效果,支持自定义切页动画.效果图如下: 在线预览 源码下载 实现的代码. ht ...
- jquery带按钮的图片切换效果
<!doctype html> <html> <head> <meta charset="gb2312"> <title> ...
- jQuery自动与手动图片切换效果下载
效果图: 查看效果:http://hovertree.com/jq/hovertreeimg/ 下载:http://hovertree.com/h/bjaf/gk8mko69.htm 使用代码: &l ...
- 10 款基于 jQuery 的切换效果插件推荐
本文整理了 10 款非常好用的 jQuery 切换效果插件,包括平滑切换和重叠动画等,这些插件可以实现不同元素之间的动态切换. 1. InnerFade 这是一个基于 jQuery 的小插件,可以实现 ...
- 基于jQuery图像碎片切换效果插件FragmentFly
基于jQuery图像碎片切换效果插件FragmentFly.这是一款只需三步轻松完成碎片动画,参数可调,使用方便. 在线预览 源码下载 部分代码: <div class="all_ ...
- jquery简单的图片切换效果,支持pc端、移动端的banner图片切换开发
详细内容请点击 无意中看见了两年前写的一个图片切换,那会儿刚刚学习网页制作,可以说是我的第一个处女座的jquery图片切换效果.无聊之余对它的宽度稍稍做了一下修改,变成了支持pc端.手机端全屏的ban ...
- [Android实例] app引导页(背景图片切换加各个页面动画效果)(申明:来源于网络)
[Android实例] app引导页(背景图片切换加各个页面动画效果)(申明:来源于网络) 地址: http://www.eoeandroid.com/thread-918356-1-1.html h ...
- css3全屏背景图片切换特效
效果体验:http://hovertree.com/texiao/css3/10/ 一般做图片切换效果,都会使用JS或者jQuery脚本,今天发现,其实只用CSS也可以实现.试试效果吧. 效果图: 代 ...
随机推荐
- VS 小插件 之 编辑器背景图片
一.引言 不知道标题的名字我描述的是否正确哈,其实就是用VS写代码的时候,背景一般都是纯白 或者 纯黑(看主题而定),那么我前段时间发现 只需要一个VS插件,居然可以给VS设置背景图片,甚至还可以循环 ...
- Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) B
Arpa is taking a geometry exam. Here is the last problem of the exam. You are given three points a, ...
- 【手撸一个ORM】第六步、对象表达式解析和Select表达式解析
说明 一个Orm自然不仅仅包含条件表达式,还会有如下的场景: OrderBy(s => s.StudentName) Select<StudentDto>(s => new S ...
- redis安装&启动
1.下载:redis.io,我下载的是5.0. 2.安装 1).tar -zxvf redis-5.0.0 2).进入src目录,执行make 3.回退到src的上一级目录,编辑redis.conf ...
- redis 拒绝远程访问解决
启动时报的警告: 1.Warning: no config file specified, using the default config. In order to specify a config ...
- NET高性能IO
System.IO.Pipelines: .NET高性能IO https://www.cnblogs.com/xxfy1/p/9290235.html System.IO.Pipelines是一个新的 ...
- sql-monitore 的bug 。
http://www.mamicode.com/info-detail-1659243.html 存储过程无法做 sql -monitor , 而存储过程跑的sql (只能通过awr 报告来看sql_ ...
- python之三级菜单
python之三级菜单 要求: 1. 运行程序输出第一级菜单 2. 选择一级菜单某项,输出二级菜单,同理输出三级菜单 3. 菜单数据保存在文件中 4. 让用户选择是否要退出 5. 有返回上一级菜单的功 ...
- 快速开启MySQL慢日志查询的方法
MySQL慢日志查询对于很多刚接触MySQL数据的新人来说比较陌生,下面就为您介绍MySQL慢日志查询的用法和好处,供您参考. mysql有一个功能就是可以log下来运行的比较慢的sql语句,默认是 ...
- 【Unity3D】点击交互——简单工厂
实现一个很简单的点击小游戏,学习交互相关的内容,在不实时创建销毁的情况下,使用简单工厂创建.管理.回收.复用标记. 游戏概述:点击出现标记,两秒内自动消失 游戏展示: 1.1实现点击效果. 1.1.1 ...