DIV的摇晃效果---jquery实现
DIV的摇晃效果---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=gb2312" />
<title>表单框抖动摇晃Jquery特效</title>
</head> <style>
html,body{
margin,padding:0;
textalign:center
} #login-right{
border: 1px solid #FFBE7A;
zoom: 1;
width:400px;
background: #FFFCED;
padding: 8px 10px;
line-height: 20px;
margin-left:auto;
margin-right:auto
}
</style> <div id="login-right" >
<form action="#" method="post" onSubmit="return check()">
<dl class="login-pannel">
<dd>
昵称:<input name="uname" type="text" id="uname" value="Eric Qin" />
<br /><br />
</dd>
<dd>
密码:<input name="pwd" type="password" id="pwd" value="Hello World!"/>
<br /><br />
</dd>
<dd >
<input type="button" id="demo" value="让DIV摆动" />
<input type="button" id="demo1" value="让控件摆动" />
<input type="button" id="demo2" value="让自己摆动" />
</dd>
<dd >
<input type="button" id="demo3" value="让控件摆动幅度大点" />
<input type="button" id="demo4" value="让控件摆动时间久点" />
<input type="button" id="demo5" value="让控件摆动速度飞快" />
</dd>
</dl> </form>
</div> <script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<script type="text/javascript" >
function flash(obj,time,wh,fx)
{
$(function(){
var $panel = $(obj);
var offset = $panel.offset()-$panel.width();
var x= offset.left;
var y= offset.top;
for(var i=1; i<=time; i++){
if(i%2==0)
{
$panel.animate({left:'+'+wh+'px'},fx);
}else
{
$panel.animate({left:'-'+wh+'px'},fx);
} }
$panel.animate({left:0},fx);
$panel.offset({ top: y, left: x }); })
}
</script>
<script>
$(function(){
var user=document.getElementById('uname');
var pwd=document.getElementById('pwd'); $("#demo").click(function(){
flash('#login-right',8,10,100); });
$("#demo1").click(function(){
flash('#uname',8,10,100); });
$("#demo2").click(function(){
flash(this,8,10,100);
});
$("#demo3").click(function(){
flash("#login-right",8,30,100);
});
$("#demo4").click(function(){
flash("#login-right",20,10,100);
});
$("#demo5").click(function(){
flash("#login-right",15,15,50);
}); }) </script>
</html>
DIV的摇晃效果---jquery实现的更多相关文章
- div拖拽效果 JQuery
<!DOCTYPE html> <html> <head> <meta name="description" content=" ...
- jQuery实现的Div窗口震动效果实例
本文实例讲述了jQuery实现的Div窗口震动效果.分享给大家供大家参考.具体如下: 这是一款jQuery窗口震动效果代码,在Div边框内点击一下鼠标,它就开始震动了,适用浏览器:IE8.360.Fi ...
- 点击弹出 +1放大效果 -- jQuery插件
20140110更新: <!doctype html> <html> <head> <meta charset="UTF-8"> & ...
- HTML 通过js实现div的拖动效果
最近做项目,碰到一个问题,需要对div实现拖动效果. 在度娘找了很多,要么觉得代码太长,要么就是效果不理想,不过最后还是找到了一个不错的,感谢大神的留贴,方便了我们,就把代码贴下面了: <!DO ...
- JaveWeb 公司项目(1)----- 使Div覆盖另一个Div完成切换效果
最近在做网页,用的是CSS+DIV的布局方法,搭建了一个简易的界面,大体上分为三个部分,如图所示: 左侧的为主功能导航栏,右侧是具体的功能实现,下方是固定的版权声明,单击左边不同的导航按钮,在div中 ...
- div拖拽缩放jquery插件编写——带8个控制点
项目中需要对div进行拖拽缩放,需要有控制面板8个控制点的那种,原以为这么常见的效果应该能搜索到很多相关插件,然而可以完成拖拽的实繁,却找不到我想要的,还是自己动手丰衣足食吧 效果预览(只支持pc端) ...
- js动画 无缝轮播 进度条 文字页面展示 div弹窗遮罩效果
1.无缝轮播 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.a ...
- CSS3 实现六边形Div图片展示效果
原文:CSS3 实现六边形Div图片展示效果 效果图: 实现原理: 这个效果的主要css样式有: 1.>transform: rotate(120deg); 图片旋转 2.>overflo ...
- 为div添加滚动效果:
为div添加滚动效果: .xxxx{ width: 100%; height: 100%; overflow: hidden; overflow-y: auto;} 代码片段 <div clas ...
随机推荐
- spring 容器技术入门
官方文档 翻译 https://waylau.gitbooks.io/spring-framework-4-reference/content/III.%20Core%20Technologies/C ...
- SCWS分词扩展在WINDOWS下的安装方法
安装之前先确认您是否拥有主机的安装权限,否则无法进行安装,安装步骤如下: 1. 根据您当前用的 PHP 版本,下载相应已编译好的 php_scws.dll 扩展库. 目前支持以下版本 [PHP-4 ...
- php 利用ffmpeg将amr转MP3
原文地址: http://www.jianshu.com/p/895d5568ce70 http://www.cnblogs.com/wanghetao/p/3386311.html http://w ...
- mysql配置mysql-proxy读写分离
MySQL配置读写分离 192.168.23.131与192.168.23.132两台服务器,131是主,132是从,131是读写,132是只读.myql-proxy的IP是192.168.23.13 ...
- VisualStudio基本使用(1)-显示行号
"工具"-"选项"-"文本编辑器"-"C/C++"-"常规",勾选"行号"复选框 ...
- WinForm中新开一个线程操作 窗体上的控件(跨线程操作控件)
最近在做一个winform的小软件(抢票的...).登录窗体要从远程web页面获取一些数据,为了不阻塞登录窗体的显示,开了一个线程去加载数据远程的数据,会报一个错误"线程间操作无效: 从不是 ...
- centos yum 安装
LINUX下YUM源配置 1.确保RHEL5中已经安装了yum [root@lvs-master ~]# rpm -qa |grep yumyum-metadata-parser-1.1.2-3.el ...
- systemctl 取代 service
要使用systemd, linux内核版本要高于: 2.6.39 systemctl的命令格式: systemctl 动作命令(如start stop restart status) 服务名称.ser ...
- HITtrainning20140417题解
题目列表: ID Origin Title 10 / 15 Problem A FZU 2152 文件系统 0 / 16 Problem B FZU 2153 A simple geome ...
- [译]ASP.NET 5: New configuration files and containers
原文:http://gunnarpeipman.com/2014/11/asp-net-5-new-configuration-files-and-containers/ ASP.NET vNext提 ...