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事件的博文,一时兴起便整理下相关的资料. 点击按钮,可以实现开关的滑动 ...
随机推荐
- WPF资源字典
如果相同的资源可用于不同的应用程序,把资源放在一个资源字典中就比较有效. 新建一个资源字典文件Dictionary1.xaml <ResourceDictionary xmlns="h ...
- 个人作业—Week1
针对教材内容的问题 阅读教材<软件工程——实践者的研究方法>Roger S.Pressman 在笼统地阅读了教材,大致理清教材知识结构后,提出以下问题作为今后学习地重点: 1) 什 ...
- photobooth.js
HTML5 Webcam for your website, photobooth.js
- url下载网页的三种方法
# -*- coding: utf-8 -*- import cookielib import urllib2 url = "http://www.baidu.com" print ...
- linux常用快捷键
linux常用快捷键:ctrl+c 强制终止当前命令ctrl+l 清屏ctrl+a 光标移动到命令行首ctrl+e 光标移动到命令行尾ctrl+u 从光标合所在的位置删除到行首ctrl+z 把命令放到 ...
- Python QQ群
微信公众号:Python中文社区 Python初级技术交流QQ群:152745094Python高级技术交流QQ群:273186166Python网络爬虫组QQ群:206241755PythonWeb ...
- Java Web学习笔记-Servle生命周期
Servlet会在服务器启动或第一次请求该Servlet的时候开始生命周期,在服务器停止的时候结束生命周期. 无论请求多少次Servlet,最多只有一个Servlet实例.多个客户端并发请求Servl ...
- 有scp命令,传输文件却显示报错无此命令
今天下午在一台服务器上使用scp命令向另外一台服务器传文件的时候,报此错误 bash: scp: command not found ,lost connection,以为是该服务器没有安装此命令,w ...
- ecshop 后台模板设置-》设置模板
ecshop后台“设置模板”出现问题 问题1:不能出现特殊符号 / <!-- TemplateBeginEditable name="5F生活数码/手机" -->&l ...
- js生成一个以零开头的八位数并且依次递增
条件:1八位数:2.以领开头:3.末尾要依次递增 <script type="text/javascript">function Account(num,a){ // ...