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事件的博文,一时兴起便整理下相关的资料. 点击按钮,可以实现开关的滑动 ...
随机推荐
- Alpha版本十天冲刺——Day 7
站立式会议 祝曹鑫杰和常松童鞋生日快乐!短短几天冲刺,就迎来了三位队员的生日,希望也给我们的Alpha版本带来好运,加油! 会议总结 队员 今天完成 遇到的问题 明天要做 感想 鲍亮 上传图片接口 无 ...
- CF715C:Digit Tree
传送门 一句话怎么说来着 算法+高级数据结构=OI 现在我感觉到的是 我会的算法+我会的高级数据结构=WA 这道题提交了三四十次,从刚看题到完全写好花了好几天..,主要死于看错费马小定理的适用条件. ...
- Raspberry Pi 3 Basic Command and Information
default username : pi default password : raspberry enter system setting interface : sudo raspi-confi ...
- Python: sort,sorted,OrderedDict的用法
Python: sort,sorted,OrderedDict的用法 from http://stqdd.com/archives/427 by 莫亚菜 python对容器内数据的排序有两种,一种是容 ...
- wpf 拖图片到窗体
前台代码:<Window x:Class="拖拽.MainWindow" xmlns="http://schemas.microsoft.com/wi ...
- Ubuntu下apt-get命令详解
在Ubuntu下,apt-get近乎是最常用的shell命令之一了,因为他是Ubuntu通过新立得安装软件的常用工具命令. 本文列举了常用的APT命令参数: apt-cache search pack ...
- 浏览器本地存储(browser-storage,HTML5-localStorage > IE-UserData > Cookie)
https://www.baidufe.com/component/browser-storage/index.html BrowserStorage是浏览器本地存储的一个解决方案,存储优先级依次为: ...
- AgularJS中Unknown provider: $routeProvider解决方案
最近在学习AgularJS, 做到http://angularjs.cn/A00a这一步时发现没有办法执行路由功能, 后来翻看控制台日志,发现提示Unknown provider: $routePro ...
- ecshop默认配置
手机端 1.C, 系统默认所有配置 输出:print_r(C())
- php上传$_FILES 无法取值
无法取值的主要原因在form. 代码 <form method="post" action="****" name="theForm" ...