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实现的更多相关文章

  1. div拖拽效果 JQuery

    <!DOCTYPE html> <html> <head> <meta name="description" content=" ...

  2. jQuery实现的Div窗口震动效果实例

    本文实例讲述了jQuery实现的Div窗口震动效果.分享给大家供大家参考.具体如下: 这是一款jQuery窗口震动效果代码,在Div边框内点击一下鼠标,它就开始震动了,适用浏览器:IE8.360.Fi ...

  3. 点击弹出 +1放大效果 -- jQuery插件

    20140110更新: <!doctype html> <html> <head> <meta charset="UTF-8"> & ...

  4. HTML 通过js实现div的拖动效果

    最近做项目,碰到一个问题,需要对div实现拖动效果. 在度娘找了很多,要么觉得代码太长,要么就是效果不理想,不过最后还是找到了一个不错的,感谢大神的留贴,方便了我们,就把代码贴下面了: <!DO ...

  5. JaveWeb 公司项目(1)----- 使Div覆盖另一个Div完成切换效果

    最近在做网页,用的是CSS+DIV的布局方法,搭建了一个简易的界面,大体上分为三个部分,如图所示: 左侧的为主功能导航栏,右侧是具体的功能实现,下方是固定的版权声明,单击左边不同的导航按钮,在div中 ...

  6. div拖拽缩放jquery插件编写——带8个控制点

    项目中需要对div进行拖拽缩放,需要有控制面板8个控制点的那种,原以为这么常见的效果应该能搜索到很多相关插件,然而可以完成拖拽的实繁,却找不到我想要的,还是自己动手丰衣足食吧 效果预览(只支持pc端) ...

  7. js动画 无缝轮播 进度条 文字页面展示 div弹窗遮罩效果

    1.无缝轮播 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.a ...

  8. CSS3 实现六边形Div图片展示效果

    原文:CSS3 实现六边形Div图片展示效果 效果图: 实现原理: 这个效果的主要css样式有: 1.>transform: rotate(120deg); 图片旋转 2.>overflo ...

  9. 为div添加滚动效果:

    为div添加滚动效果: .xxxx{ width: 100%; height: 100%; overflow: hidden; overflow-y: auto;} 代码片段 <div clas ...

随机推荐

  1. Spring系列之基本配置

    一.概述Spring是一个轻量级的Java开源框架,是为了简化企业级系统开发而诞生的.Spring的核心是控制反转(IOC)和面向切面编程(AOP).主要有以下几个特点:(1)轻量:从大小和开销两方面 ...

  2. 机器学习的5种语言(选自info world)

    摘要:机器学习目前炙手可热,本文搜集了Java.Python以及go等编程语言中常见且实用的开源机器学习工具,对机器学习感兴趣的开发者或者准备和机器学习打交道的数据科学家们不能错过了 [编者按] 机器 ...

  3. PHP从零开始-笔记-面向对象编程的概念

    面向对象变成的概念 需要一一种不同的方式来考虑如何构造应用程序.通过对象可以在对应用程序所处理的显示任务.过程和思想进行编码是,实施更贴切的建模.OOP方法并不是将应用程序考虑成一个将大量数据从一个函 ...

  4. Mastering Web Application Development with AngularJS 读书笔记-前记

    学习AngularJS的笔记,这个是英文版的,有些地方翻译的很随意,做的笔记不是很详细,用来自勉.觉得写下来要比看能理解的更深入点.有理解不对的地方还请前辈们纠正! 一.关于<Mastering ...

  5. spring 缓存(spring自带Cache)(入门)源码解读

    spring自带的缓存类有两个基础类:Cache(org.springframework.cache.Cache)类,CacheManager(org.springframework.cache.Ca ...

  6. SGU 495. Kids and Prizes

    水概率....SGU里难得的水题.... 495. Kids and Prizes Time limit per test: 0.5 second(s)Memory limit: 262144 kil ...

  7. Bots(逆元,递推)

    H. Bots time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input out ...

  8. Swift3.0P1 语法指南——基本操作符

    原档:https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programmi ...

  9. EF接触03

    emdx文件解读:

  10. 关于百度地图api测距显示NaN的解决方案

    因为随着百度地图的api的升级,测距的函数以及语句都发生的一定变化. 在调用api测距的时候通常我们使用的是语句map.getDistance(marker1,marker2); 但为什么这么简单的测 ...