jQuery 写的插件图片上下切换幻灯效果
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery 幻灯效果 上下切换</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<style type="text/css">
/** css Reset star like yahoo **/
body, div, ul, ol, li, h1, h2, h3, h4, h5, h6, form, input, p, th, td {
padding: 0;
margin: 0;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
fieldset, img {
border: 0;
}
ul,li{list-style:none;}
h1, h2, h3, h4, h5, h6 {
font-weight: normal;
font-size: 100%;
}
#wrapper {
border:1px #ccc solid;
position:relative;
overflow:hidden;
width:573px;
height:257px;
font-size:14px;
font-family:Tahoma, Geneva, sans-serif;
}
#number {
width:88px;
position:absolute;
left:10px;
bottom:10px;
}
#number li {
padding-left:6px;
float:left;
text-indent:-9999px;
width:16px;
height:16px;
overflow:hidden;
background-image:url(../images/number1.png);
background-repeat:no-repeat;
}
#buttom_0 {
background-position:0 0;
}
#buttom_1 {
background-position:-22px 0;
}
#buttom_2 {
background-position:-44px 0;
}
#buttom_3 {
background-position:-66px 0;
}
#buttom_0.selected {
background-position:0 -16px;
}
#buttom_1.selected {
background-position:-22px -16px;
}
#buttom_2.selected {
background-position:-44px -16px;
}
#buttom_3.selected {
background-position:-66px -16px;
}
/* */
.content_right{float:left;}
.content_right .ad {
margin-bottom:10px; width:573px;
height:257px;
overflow:hidden;
position:relative;
}
.content_right .slider,.content_right .num{
position:absolute;
}
.content_right .slider li{
}
.content_right .slider img{
width:573px;
height:257px;
display:block;
}
.content_right .num{
right:5px;
bottom:5px;
}
.content_right .num li{
float: left;
color: #069;
text-align: center;
line-height: 16px;
width: 16px;
height: 16px;
font-family: Arial;
font-size: 12px;
cursor: pointer;
overflow: hidden;
margin: 3px 1px;
border: 1px solid #069;
background-color: #fff;
}
.content_right .num li.on{
color: #fff;
line-height: 16px;
width: 16px;
height: 16px;
font-size: 14px;
margin: 3px 1px;
border: 1px solid #069;
background-color: #069;
font-weight: bold;
}
</style>
<script type="text/javascript">
/**
* author jackluo
*/
/*首页广告效果*/
(function($){ $.fn.webjoy = function(option){
void 0 === option && (option = {});
var defaults = {
slideshowSpeed:2000,
animationSpeed:1000,
direction:'top',
},
opt = $.extend({},defaults,option);
var a = $(this),
slideshowSpeed = 2000,
animationSpeed =1000,
c = a.find(opt.selector ? opt.selector: ".num > li")
s = a.find(opt.slider ? opt.slider: ".slider"); slider = function(){
var len = c.length,
index=0, adTimer;
opt.direction == 'top'?index = len-1:index=0;
c.mouseover(function(){//鼠标移进效果
index = c.index(this); //
void opt.direction == 'top'?topshowImg(index):bottomshowImg(index); //
}).eq(index).mouseover();//手动设置事件
//滑动停止动画,滑出开发动画
a.hover(function(){
clearInterval(adTimer);
},function(){
setInterval(function(){
if(opt.direction == 'top'){
topshowImg(index);
index--;
if(index<0){index=len-1;} }else{
bottomshowImg(index);
index++;
if(index==len){index=0;}
}
},opt.slideshowSpeed)
}).trigger("mouseleave");
};
//向上切换
topshowImg = function(index){
var adHeight = a.height();
s.stop(true,false).animate({top : -adHeight*index},opt.animationSpeed);
c.removeClass("on").eq(index).addClass("on");
}
//向下切换
bottomshowImg = function(index){
var adHeight = a.height();
s.stop(true,false).animate({bottom: -adHeight*index},opt.animationSpeed);
c.removeClass("on").eq(index).addClass("on");
}
slider();
}
})(jQuery); $(function(){
$('.content_right .ad').webjoy({slideshowSpeed:2000,animationSpeed:1000,direction:'top'});
}); </script>
</head>
<body>
<div class="content_right">
<div class="ad" >
<ul class="slider" >
<li ><a href="#"><img src="http://pic002.cnblogs.com/images/2011/334763/2011120516434445.jpg" width="573" height="257" /></a></li>
<li ><a href="#"><img src="http://pic002.cnblogs.com/images/2011/334763/2011120516440935.jpg" width="573" height="257" /></a></li>
<li ><a href="#"><img src="http://pic002.cnblogs.com/images/2011/334763/2011120516443665.jpg" width="573" height="257" /></a></li>
<li ><a href="#"><img src="http://pic002.cnblogs.com/images/2011/334763/2011120516445513.jpg" width="573" height="257" /></a></li>
</ul>
<ul class="num" >
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
</div>
</div>
</body>
</html>
jQuery 写的插件图片上下切换幻灯效果的更多相关文章
- 基于jQuery带标题的图片3D切换焦点图
今天给大家分享一款基于jQuery带标题的图片3D切换焦点图.这款焦点图适用浏览器:IE8.360.FireFox.Chrome.Safari.Opera.傲游.搜狗.世界之窗. 实现的代码. htm ...
- 基于jquery鼠标点击图片翻开切换效果
基于jquery鼠标点击图片翻开切换效果是一款基于jQuery+CSS3实现的点击图片切换特效.效果图如下: 在线预览 源码下载 实现的代码. html代码: <div class=&quo ...
- 基于jquery仿360网站图片选项卡切换代码
今天给大家分享一款基于jquery仿360网站图片选项卡切换代码.这款实例适用浏览器:IE8.360.FireFox.Chrome.Safari.Opera.傲游.搜狗.世界之窗.效果图如下: 在线预 ...
- jQuery框架开发一个最简单的幻灯效果
在线演示 在这个课程中,我们将介绍如何使用jQuery来开发一个最简单的图片幻灯效果. 立刻观看互动课程:jQuery框架开发一个最简单的幻灯效果 阅读原文:jQuery框架开发一个最简单的幻灯效果
- 用css来写一个背景图片的切换
代码如下: <!DOCTYPE HTML> <htmllang="en-US"> <head> <meta charset="U ...
- jQuery滑过头像图片展示个人信息效果
这是一款经典的jQuery图片插件,同时,也可以是一款jQuery提示框插件.这款jQuery插件的功能是当你把鼠标滑过头像图片缩略图时,即可弹出头像对应用户的详细个人信息,弹出的标签虽然不大,但是还 ...
- liMarquee – jQuery无缝滚动插件(制作跑马灯效果)
liMarquee 是一款基于 jQuery 的无缝滚动插件,类似于 HTML 的 marquee 标签,但比 marquee 更强大.它可以应用于任何 Web 元素,包括文字.图像.表格.表单等元素 ...
- 利用jquery写的一个TAB页切换效果
函数如下 /** *切换效果 */ function switab(tab,con,tab_c_css,tab_n_css,no) { $(tab).each(function(i){ if(i == ...
- 自己写了一个图片的马赛克消失效果(jQuery)
其中的一个效果: html代码: <h1>单击图片,产生效果</h1> <div class="box"></div> 插件代码: ...
随机推荐
- 一段功能齐全的PHP常用重定向代码html+js+header
/** * 重定向浏览器到指定的 URL * * @param string $url 要重定向的 url * @param int $delay 等待多少秒以后跳转 * @param bool $j ...
- InnoDB主键设计
InnoDB是clustered-index table,因此对于InnoDB而言,主键具有特殊意义. 可以通过主键直接定位到对应的某一数据行记录的物理位置,主键索引指向对应行记录,其他索引则都指向主 ...
- Android PullToRefreshListView上拉刷新和下拉刷新
PullToRefreshListView实现上拉和下拉刷新有两个步骤: 1.设置刷新方式 pullToRefreshView.setMode(PullToRefreshBase.Mode.BOTH) ...
- Cocos2d-x 学习资料推荐
最近在看Cocos2d-x ,官网的资料太少了,下面推荐一些比较好的教程,不断更新中. 1. cocos2d-x高级开发教程 如果你懂得objective-c 那么一定要看看这本书,这里面有许多C++ ...
- Ubuntu 用户安装 MATE
MATE 是经典桌面 Gnome 2 的分支,该桌面按照 Windows 用户操作习惯设计,适合于 Windows 转投 Linux 的初级用户,MATE 做了功能改进和新增功能.如:增加窗口管理 ...
- 【USACO】milk3
倒牛奶的问题, 开始看感觉跟倒水的问题很像, 想直接找规律, 写个类似于循环取余的代码. 但后来发现不行,因为这道题有三个桶,水量也是有限制的.只好用模拟的方法把所有的情况都试一遍. 建一个state ...
- 用Navicat for oracle导入现有数据库
重要参考:http://www.admin5.com/article/20130420/499241.shtml 前期准备,参考另一篇随笔. 安装Oracle,PL/SQL, 新建表空间myTS,新建 ...
- dbvisualizer中文乱码
.dbvisualizer中文乱码 tools--tool properties找到Fonts--修改SQL Editor/Text Editor 将字体换成:微软雅黑.新宋体.楷体.黑体 .dbvi ...
- 练习prototype的实现
这个BLOG不错,我练习了一下代码. 感觉他是个高手. ======================== http://www.w3cfuns.com/notes/17398/35b250e9b392 ...
- ytu 1789:n皇后问题(水题,枚举)
n皇后问题 Time Limit: 1 Sec Memory Limit: 64 MB Special JudgeSubmit: 12 Solved: 3[Submit][Status][Web ...