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事件的博文,一时兴起便整理下相关的资料. 点击按钮,可以实现开关的滑动 ...
随机推荐
- ThinkPHP中field 方法与getField 方法的区别。
做项目的时候遇到了一个问题,框架生成的sql与放到navicat中执行.和页面显示出来的结果不太一样. 排查了很久,也没有找到问题. 出现问题的sql如下. $fuck = M(null, null, ...
- 卸载自己编译的程序(ubuntu14.04)
cd 源代码目录make clean./configuremake uninstall
- Linux 问题汇总
centos主机发现大量的TIME_WAIT 解决方法: vim /etc/sysctl.conf #编辑文件,加入以下内容: net.ipv4.tcp_syncookies = 1 net.ipv ...
- 爬虫2 url管理器 url_manager.py
#coding:utf8 class UrlManager(object): def __init__(self): self.new_urls = set() self.old_urls = set ...
- angularjs笔记(三)
AngularJS API 7.其他一些常用指令,布尔类型的指令也可以用表达式 (1).数组索引$index <!DOCTYPE html> <html> <head&g ...
- 9月22日下午JavaScript----Document对象
document对象 一.找元素 1.根据id找 示例: <input id = "a" type="button" value="找元素&qu ...
- JavaScript学习笔记——函数
javascript函数的声明和调用 将完成某一特定功能的代码集合起来,可以重复使用的代码块. 一.函数的声明方式(创建) A.基本语法 function 关键字 function 函数名([参数1] ...
- 60行JavaScript俄罗斯方块
<!doctype html><html><head></head><body> <div id="box" st ...
- ctypes 操作 python 与 c++ dll 互传结构体指针
CMakeLists.txt # project(工程名) project(blog-3123958139-1) # add_library(链接库名称 SHARED 链接库代码) add_libra ...
- js获取某个ID的class名称
.HTML结构 <div id = "test" class="test_class">我的类名为test_class</div> &l ...