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事件的博文,一时兴起便整理下相关的资料. 点击按钮,可以实现开关的滑动 ...
随机推荐
- BZOJ1933: [Shoi2007]Bookcase 书柜的尺寸
传送门 很容易看出来这是一道DP题,那么怎么设置状态就成了这道题的关键.本题有点特殊的地方是有两个维度的状态,而每个维度又有三个部分的参数,如果全部设置出来的话肯定会MLE.首先对书的厚度状态简化. ...
- try throw catch
#include "stdafx.h" #include <iostream> #include <stdlib.h> using namespace st ...
- WinForm------DockManager控件的使用方法(里面包含DockPanel控件)
1.在"引用"中添加DevExpress.XtraBars和DexExpress.XtraNavBar程序集 2.往工具栏拖出DockManager控件,点击右上角的小三角,再点击 ...
- Spring MVC学习笔记——用户增删该查和服务器端验证
建立一个动态web项目,起名为SpringMVC_crud 导包,其中包括jstl的一些包等 1.先写一个User.java,是用户类 文件User.java文件 package org.common ...
- Android学习笔记——CheckBox
该工程的功能实现在一个activity中显示一个单选框和一个多选框 以下代码是MainActivity.java文件中的代码 package com.example.checkbox; import ...
- Ubuntu 15.10安装KVM
1.查看cpu是否支持硬件虚拟化 egrep "svm|vmx" /proc/cpuinfo 2.安装KVM apt-get install qemu-kvm virt-manag ...
- ecshop 版权问题 Powered by ECShop
将下代码 <div style="width:0px;height: 0px;overflow:hidden;">{foreach from=$lang.p_y ite ...
- 谷歌浏览器 查看源码里的a:hover CSS样式 还有火狐的查看方式
谷歌浏览器查看hover css样式 直接实例: 选中a标签 然后右侧面板 出现 箭头 点击 出现Toggle Element state提示 下面再hover前打勾 直接就可以显示效果了 浏览器查看 ...
- centos 7.0 查看根目录下所有文件夹
centos 7.0最小化安装 第一行是登录 [root@localhost ~]# [root@localhost ~]# cd ../ [root@localhost /]# ls bin dev ...
- redis入侵小结
redis安装: windows安装包:http://pan.baidu.com/s/1i3jLlC5 下载下来之后,开始安装: redis-server.exe redis.conf: 简单一步,安 ...