/**
* jQuery.hhNewSilder 滚动图片插件
* User: huanhuan
* QQ: 651471385
* Email: th.wanghuan@gmail.com
* 微博: huanhuan的天使
* Date: 13-7-4
* Time: 下午5:20
* Dependence jquery-1.7.2.min.js
*/
$(function(){
$.fn.hhNewSilder = function(infor){
var defaults = {
autoTimer:6000,
speed:1000,
picBox:'thDSpic',
circleBox:'thDSnumber',
leftEle:'thDSprev',
rightEle:'thDSnext',
preLoadSrc:'images/loading.gif',
autoPlay:true,
imgBox:function(){return GetBox();},
imgBoxSize:function(){return GetSize();}
};
var option = $.extend(defaults, infor || {}),
circleLi = option.imgBox().circleLi,
imgList = option.imgBox().imgList,
imgSize = option.imgBoxSize(),
_thisAll = $(this),
n = 1;
$('.'+option.circleBox).find('li:eq(0)').addClass('thScrusor');
//拿到li
function GetBox(){
this.circleLi = $('.'+option.circleBox,_thisAll).find("li");
this.imgList =$('.'+option.picBox,_thisAll).find("li");
return this;
}
//设置宽度、高度
function GetSize(){
this.w = $('.'+option.picBox,_thisAll).width();
this.h = $('.'+option.picBox,_thisAll).height();
return this;
}
var s = GetSize;
s.w
//设置ul的宽度
$('.'+option.picBox, _thisAll).find('ul').css({
width : imgList.width() * imgList.length
});
/*function getSiz(){
var w = $('.'+option.picBox,_thisAll).width();
var h = $('.'+option.picBox,_thisAll).height();
return { w: w, h: h}
}
var size = getSiz();
size.w*/
return this.each(function(){
//初始化时给li添加class="show"
imgList.eq(0).addClass('show').css({'left':0}).siblings().removeClass('show').css({'left':imgSize.w});
function Play(){
if(imgList.is(':animated')) return; //如果在运动则返回
var _index = $('.'+option.picBox).find('li.show').index(); //得到当前的
_index = _index == "-1" ? 0 : _index;
if(imgList.eq(n).hasClass('show')) return; //如果有show class则返回
circleLi.eq(n).addClass('thScrusor').siblings().removeClass('thScrusor'); //圆点
imgList.slice(_index,_index+1).animate({'left':-imgSize.w},option.speed,function(){
$(this).css({'left':imgSize.w});
}).removeClass('show');
imgList.eq(n).animate({left:0},option.speed).addClass('show'); //当前li添加show属性
//追加
if(imgList.length-1>n){
n++;
}else{
n=0;
}
}
_init = function(){
var x=null;
$('.'+option.picBox).find('li:gt(0)').css('left',imgSize.w);
if(option.autoPlay) x=setInterval(Play,option.autoTimer);
circleLi.click(function(){
n = $(this).index();
Play();
if(option.autoPlay){
clearInterval(x);
x=setInterval(Play,option.autoTimer);
}
});
//左右按钮绑定事件
$('.'+option.leftEle+',.'+option.rightEle).css({'opacity':'0.3'}).live({
mouseover:function(){
$(this).stop(true,false).animate({'opacity':'1'},400);
},
mouseout:function(){
$(this).stop(true,false).animate({'opacity':'0.3'},400);
},
click:function(){
var _index = $('.'+option.picBox).find('li.show').index();
if($(this).attr('class')==option.leftEle){
n = _index==0?(imgList.length-1):_index-1;
}else{
n = _index==(imgList.length-1)?0:_index+1;
}
Play();
if(option.autoPlay){
clearInterval(x);
x=setInterval(Play,option.autoTimer);
}
}
});
}
return _init();
});
}
});
- jQuery.hhLRSlider 左右滚动图片插件
/** * jQuery.hhLRSlider 左右滚动图片插件 * User: huanhuan * QQ: 651471385 * Email: th.wanghuan@gmail.com ...
- jQuery页面滚动图片等元素动态加载实现
一.关于滚动显屏加载 常常会有这样子的页面,内容很丰富,页面很长,图片较多.比如说光棍节很疯狂的淘宝商城页面. 或者是前段时间写血本买了个高档耳机的京东商城页面,或者是新浪微博之类. 这些页面图片数量 ...
- [转]jQuery页面滚动图片等元素动态加载实现
本文转自:http://www.zhangxinxu.com/wordpress/?p=1259 一.关于滚动显屏加载 常常会有这样子的页面,内容很丰富,页面很长,图片较多.比如说光棍节很疯狂的淘宝商 ...
- 自己写一个jQuery垂直滚动栏插件(panel)
html中原生的滚动栏比較难看,所以有些站点,会自己实现滚动栏,导航站点hao123在一个側栏中,就自己定义了垂直滚动栏,效果比較好看,截图例如以下: watermark/2/text/aHR0cDo ...
- [JQuery]ScrollMe滚动特效插件
最近考完试,一切顺利,昨晚闲着无聊把最近要用的一个插件翻译了一下:ScrollMe. (╯‵□′)╯︵┻━┻地址请戳: /* ScrollMe -李明夕翻译(╯‵□′)╯︵┻━┻ */ ScrollM ...
- jQuery scrollFix滚动定位插件
[插件功能] 当用户向上或向下滚动页面到一定位置时,目标元素开始固定定位(position:fixed),当回滚到原位置时目标元素恢复到原状态,可以定制触发滚动相对屏幕位置和触发滚动方向,兼容IE6 ...
- 页面滚动图片等元素动态加载插件jquery.scrollLoading.js
如果一个网页很长,那么该页面的加载时间也会相应的较长.而这里给大家介绍的这个jQuery插件scrollLoading的作用则是,对页面元素进行动态加载,通俗的说就是滚到哪就加载到哪,屏幕以下看不见的 ...
- 利用jQuery无缝滚动插件liMarquee实现图片(链接)和文字(链接)向右无缝滚动(兼容ie7+)
像新闻类的版块经常要求一条条的新闻滚动出现,要实现这种效果,可以使用jQuery无缝滚动插件liMarquee. 注意: 1. 它的兼容性是IE7+,及现代浏览器. 2. 引用的jquery的版本最好 ...
- jquery 单行滚动、批量多行滚动、文字图片翻屏滚动效果代码
jquery单行滚动.批量多行滚动.文字图片翻屏滚动效果代码,需要的朋友可以参考下. 以下代码,运行后,需要刷新下,才能加载jquery,要不然看不到效果.一.单行滚动效果 <!DOCTYPE ...
随机推荐
- html5非常火,他究竟与html4有何差别?
HTML5是HTML标准的下一个版本号.越来越多的程序猿開始HTML5来构建站点.假设你同一时候使用HTML4和HTML5的话 ,你会发现用HTML5从头构建.比从HTML4迁移到HTML5要方便非常 ...
- go操作数据库 Go-SQL-Driver/MySQL 使用详解
go操作mysql的驱动包很多,这里讲解当下比较流行的Go-SQL-Driver/MySQL1.下载安装 执行下面两个命令: 下载:go get github.com/Go-SQL-Driver/My ...
- [React Fundamentals] Component Lifecycle - Mounting Usage
The previous lesson introduced the React component lifecycle mounting and unmounting. In this lesson ...
- [MODx] 9. Real Example
Snippet code: <?php $path = MODX_CORE_PATH . 'components/storefinder/'; $result = $modx->addPa ...
- 未定义标识符_ConnectionPtr
我的编译环境 vs2010 你会明白的图片,那么多 无用!
- 安装完zend server后,无法访问http://localhost:10081/ZendServer/的解决办法
安装完ZendServer后,默认会设置http://localhost:10081/ZendServer/为ZendServer的后台管理页面, 但对于ZendServer5.0.2(其它版本未知) ...
- android122 zhihuibeijing 新闻中心NewsCenterPager加载网络数据实现
新闻中心NewsCenterPager.java package com.itheima.zhbj52.base.impl; import java.util.ArrayList; import an ...
- dtrace4linux
http://www.oschina.net/p/dtrace4linux?fromerr=ZSxqzDcE
- 自定义控件(视图)1期笔记01:View 和 ViewGroup
1.View 和 ViewGroup 图解关系: 2. View 和 ViewGroup 关系和作用: (1) 关系: • 继承关系 • 组合关系 (2) 作用: • View的作用: 提供 ...
- show variables 详解
back_log MySQL主线程检查连接并启动一个新线程这段时间内,可以设置多少个请求可以被存在堆栈中 connect_timeout 连接超时 检测方法nmap -p3306 数据库ip dela ...