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 src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#bta").click(function () {
$("#unit").css("left", "300px");
document.getElementById("unit").style.left = "300px";
// var container = document.getElementById("unit");
// try {
// container.insertBefore(container.lastChild, container.firstChild)
// }
// catch (e) { alert(e); }
$("#unit").prepend($("#unit>div:last"));
$("#unit").animate({ "left": 0 }, 500);
//$("#unit").stop(true, false).animate({ "left": 0 }, 500); });
$("#btb").click(function () {
$("#unit").animate({ "left": -300 }, 500);
//$("#unit").stop(true, false).animate({ "left": -300 }, 500); function gundong() {
$("#unit").css("left", "0px");
//document.getElementById("unit").style.left = "0px";
$("#unit").append($("#unit>div:first"));
// var container = document.getElementById("unit");
// try {
// container.appendChild(container.firstChild);
// }
// catch (e) { alert(e); }
}//等待动画滚动后执行
setTimeout(function () { gundong() }, 700);
})
}); </script>
<style type="text/css">
*
{
padding: 0;
margin: 0;
}
#box
{
width: 300px;
height: 150px;
margin-bottom: 50px;
position: relative;
overflow: hidden;
}
#unit
{
width: 1200px;
position: absolute;
}
#unit div
{
float: left;
width: 300px;
height: 150px;
}
#bga
{
background-color: #F30;
}
#bgb
{
background-color: #F90;
}
#bta, #btb
{
float: left;
width: 50px;
padding-right: 50px;
color: #FFF;
cursor: pointer;
}
</style>
</head>
<body>
<div style="width: 800px; height: 300px; padding-top: 100px; background-color: #999;
margin: 0 auto;">
<div id="box">
<div id="unit">
<div id="bga">
框一</div>
<div id="bgb">
框二</div>
<div id="bgc">
框三</div>
<div id="bgd">
框四</div>
</div>
</div>
<div id="bta">
左</div>
<div id="btb">
右</div>
</div>
</body>
</html>
jquery左右滑动效果的实现的更多相关文章
- js进阶 13-2 jquery动画滑动效果哪些注意事项
js进阶 13-2 jquery动画滑动效果哪些注意事项 一.总结 一句话总结:滑动里面这里up是隐藏,down是显示. 1.jquery动画默认的两个切换效果是什么(swing默认和linear的区 ...
- jquery 上下滑动效果
<script type="text/javascript"> var myar = setInterval('AutoScroll(".li_gundong ...
- Jquery Mobile左右滑动效果
首先在一个页面里面定义两个< div data-role="page">,这里为了突出重点,就没有写出footer和header.定义的页面如下: <body&g ...
- jquery 实现导航栏滑动效果
精简的代码实现导航栏滑动效果,实现详解: 1.滑块位置:通过父节点position=fixed,子节点position=absolute方式,实现子节点浮动: 2.导航栏居中:通过left=0px,r ...
- jquery的slideUp、slideDown、slideToggle等涉及滑动效果的一系列函数,在IE浏览器下有几处bug
jquery的slideUp.slideDown.slideToggle等涉及滑动效果的一系列函数,在IE浏览器下有几处bug: 1. 因position引起的问题 影响:IE全系列 症状:在需要sl ...
- jquery 如何实现回顶部 带滑动效果
$("#returnTop").click(function () { var speed=200;//滑动的速度 $('body,html').animate({ scrollT ...
- bootstrap实现 手机端滑动效果,滑动到下一页,jgestures.js插件
bootstrap能否实现 手机端滑动效果,滑动到下一页 jgestures.js插件可以解决,只需要引入一个JS文件<script src="js/jgestures.min.js& ...
- 全新jquery多点滑动幻灯片——全屏动画animateSlide
首页banner的酷炫效果多来自全屏大图的幻灯片动画,下面提供一种完美兼容的jquery动画特效:全新jquery多点滑动幻灯片——全屏动画animateSlide(代码完全原创). 直接上代码,把h ...
- 滑动开关效果 css3滑动开关】纯CSS3代码实现滑动开关效果-css3滑动效果-css3左右滑动
今天看到一篇有关 css3事件的博文,一时兴起便整理下相关的资料. 点击按钮,可以实现开关的滑动效果. 今天看到一篇有关 css3事件的博文,一时兴起便整理下相关的资料. 点击按钮,可以实现开关的滑动 ...
随机推荐
- 深入理解JavaScript中的属性和特性
深入理解JavaScript中的属性和特性 JavaScript中属性和特性是完全不同的两个概念,这里我将根据自己所学,来深入理解JavaScript中的属性和特性. 主要内容如下: 理解JavaSc ...
- vmware tools 在linux中的作用
VMware Tools是VMware虚拟机中自带的一种增强工具,相当于VirtualBox中的增强功能 是VMware提供的增强虚拟显卡和硬盘性能 以及同步虚拟机与主机时钟的驱动程序. 只有在VMw ...
- Processing Images
https://developer.apple.com/library/content/documentation/GraphicsImaging/Conceptual/CoreImaging/ci_ ...
- 通过Nginx,Tomcat访问日志(access log)记录请求耗时
一.Nginx通过$upstream_response_time $request_time统计请求和后台服务响应时间 nginx.conf使用配置方式: log_format main '$remo ...
- Distinct
SELECT 指令让我们能够读取表格中一个或数个栏位的所有资料.这将把所有的资料都抓出,无论资料值有无重复.在资料处理中,我们会经常碰到需要找出表格内的不同资料值的情况.换句话说,我们需要知道这个表格 ...
- FreeImage使用
http://blog.csdn.net/byxdaz/article/details/6056509 http://blog.chinaunix.net/uid-20660110-id-65639. ...
- Memcached【Magent+Memcached】集群
Memcached介绍 事件处理libevent是个程序库,它将Linux的epoll.BSD类操作系统的kqueue等事件处理功能封装成统一的接口.即使对服务器的连接数增加,也能发挥O(1)的性能 ...
- OC-基本
#import <Foundation/NSObjCRuntime.h> //import: //1,同#include一样, 拷贝文件内容 //2,可以自动防止文件的内容被重复拷贝 /* ...
- js实现在末尾添加节点
在末尾添加节点: 1.获取ul标签 2.创建li标签 document.createElement("标签名称")方法 3.创建文本 document.createTextNode ...
- jQuery里$(this)和this的区别在哪?
$(this)是jquery对象,能调用jquery的方法,例如click(), keyup().而this,则是html元素对象,能调用元素属性,例如this.id,this.value.例如假设已 ...