`

Fantastic Bouncy Effect using jQuery/JavaScript

阅读更多

文章源自:http://viralpatel.net/blogs/jquery-bounce-effect-bounce-html-js/

Fantastic Bouncy Effect using jQuery/JavaScript

Our Goal will be to create a HTML page that has 4 boxes (DIVs). Clicking each of these boxes will bounce them is a particular direction. We can control the direction as well as the speed of bouncing element with arguments to the method of jQuery.

Step 1: The HTML Code

Following will be the HTML code for our example:

 

<table>
<tr>
    <td><div id="bouncy1">Click here to bounce. Direction: Up</div></td>
    <td><div id="bouncy2">Click here to bounce. Direction: Left</div></td>
</tr>
<tr>
    <td><div id="bouncy3">Click here to bounce. Direction: Right</div></td>
    <td><div id="bouncy4">Click here to bounce. Direction: Down</div></td>
</tr>
</table>
<br/>
<input id="bounceAll" type="button" value="Click to Bounce All!"/>

 

 

Step 2: The Stylesheet CSS Code

Just to add some color to our boxes, add following CSS code to your HTML:

div {
    padding:5px;
    width:150px;
    height:100px;
    text-align:center;
}
#bouncy1 {
    background-color:#FFEE88;
}
#bouncy2 {
    background-color:#EE88FF;
}
#bouncy3 {
    background-color:#EE8888;
}
#bouncy4 {
    background-color:#88EEFF;
}

 

Step 3: The jQuery/JavaScript Code

Now we will give the actual bounce effect to the demo. We will use jQuery library for this. Also we need to include jQuery UI for bounce effect. For this we will include js files from google apis. Google host the jQuery UI and jQuery core files on their server. We can directly include it from there.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>

 Also copy following code in your HTML to give final bounce effect.

$(function(){
 
    //Add bounce effect on Click of the DIV
    $('#bouncy1').click(function () {
          $(this).effect("bounce", { times:5 }, 300);
    });
 
    $('#bouncy2').click(function () {
          $(this).effect("bounce", { direction:'left', times:5 }, 300);
    });
 
    $('#bouncy3').click(function () {
          $(this).effect("bounce", { direction:'right', times:5 }, 300);
    });
 
    $('#bouncy4').click(function () {
          $(this).effect("bounce", { direction:'down', times:5 }, 300);
    });
 
    //Bounce all DIVs on click of button
    $("#bounceAll").click(function(){
        $("div").click();
    });
});

 

 

 

 

  • 大小: 6.7 KB
分享到:
评论
发表评论

文章已被作者锁定,不允许评论。

相关推荐

    org.bouncycastle.jar

    解决org/bouncycastle/jce/provider/bouncycastlepr错误专用。

    AES加密解密工具,主页在http://www.bouncycastle.org/

    小程序登录里用到的,登陆教程地址https://www.jianshu.com/p/bcee184efe76

    org.bouncycastle 加密算法包 最新1.69版

    ** org.bouncycastle 加密算法包详解 ** `org.bouncycastle` 是一个开源的 Java 库,专门用于实现各种加密算法和相关的安全服务。它提供了广泛的加密功能,包括对称和非对称加密、数字签名、哈希函数、证书管理、...

    在线等待解决java tomcat 报错问题:java.lang.NoClassDefFoundError: javax/tools/StandardJavaF

    标题中的“java.lang.NoClassDefFoundError: javax/tools/StandardJavaFile”是一个常见的Java运行时错误,它表示在类路径中找不到某个类的定义。这个错误通常发生在试图执行包含特定类的代码,但该类在运行时环境中...

    org.bouncycastle完整资源包

    《深入解析org.bouncycastle:Java安全加密与证书权威库》 在Java开发中,安全性是不可或缺的一部分,尤其是在处理敏感数据、网络通信以及数字签名时。`org.bouncycastle`库是一个强大的开源加密库,为Java开发者...

    使用Jmeter测试java请求

    在IT行业中,性能测试是确保应用稳定性和可扩展性的重要环节。Apache JMeter是一款广泛应用的开源性能测试工具,尤其适合对Web应用进行压力和负载测试。在这个场景中,我们将探讨如何利用JMeter来测试Java请求。...

    Org.BouncyCastle.Utilities.Encoders 等命名空间所需库

    主要用于加解密,我是在使用解密SM4 时接触到的,在网上代码引用了Org.BouncyCastle.Utilities.Encoders,找不到库 自己在网上找了好久找到了,没有积分的可以去http://www.bouncycastle.org/csharp/ 下载

    BouncyCastle.Crypto.dll

    BouncyCastle.Crypto.dll V1.8.4 C#版本 http://www.bouncycastle.org/csharp/index.html

    bouncycastle的util工具类

    bouncy castle(轻量级密码术包)是一种用于 Java 平台的开放源码的轻量级密码术包。它支持大量的密码术算法,并提供 JCE 1.2.1 的实现。

    TongWeb7中conf.doc

    另一个常见的问题涉及到`org.bouncycastle.asn1.ASN1EncodableVector`和`org.bouncycastle.asn1.DEREncodableVector`这两个类。它们之间存在循环继承关系,这可能导致`StackOverflowError`。为了解决这个问题,同样...

    Android代码-ChatSecureAndroid

    ChatSecure for Android (previously known as Gibberbot) is a secure ...Original wallpaper generated using Tapet app and Gimp: https://play.google.com/store/apps/details?id=com.sharpregion.tapet and

    bouncycastle1.59 帮助文档(包含html源文件制作工具)

    《BouncyCastle1.59帮助文档:深入理解与CHM制作详解》 BouncyCastle,作为Java和.NET平台上广泛使用的开源加密库,为开发者提供了丰富的加密算法、密码学标准接口以及证书处理功能。这份“BouncyCastle1.59帮助...

    Bouncy Castle 1.64 API及制作工具

    **Bouncy Castle 1.64 API 深度解析** Bouncy Castle 是一个开源的 Java 安全库,提供了一整套加密算法、证书、SSL/TLS 协议以及 PKCS#7、PKCS#12、OpenSSL、CMS、S/MIME 和 X.509 的实现。在 1.64 版本中,这个库...

    SM2加密算法签名(超全,亲测可用)

    SM2加密算法签名(超全,亲测可用),需要依赖包,maven项目可以在pom.xml中引入 &lt;groupId&gt;org.bouncycastle&lt;/groupId&gt; &lt;artifactId&gt;bcprov-jdk15on&lt;/artifactId&gt; &lt;version&gt;1.54&lt;/version&gt; &lt;/dependency&gt;

    bcprov-jdk15on-1.59-API文档-中英对照版.zip

    标签:bouncycastle、bcprov、jdk15on、中英对照文档、jar包、java; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持不变,注释和说明...

    C# 实现与JAVA互通 加签/验签,RSA加密/解密

    * RSA加密解密:私钥解密,公钥加密。 * RSA数字签名-俗称加签验签:私钥加签,公钥验签。  * RSA加密解密:私钥解密,公钥加密。 * RSA数字签名-俗称加签验签:私钥加签,公钥验签。...BouncyCastle加签/验签

    BouncyCastle依赖.zip

    BouncyCastle是一个强大的Java安全库,它为加密、数字签名、证书处理以及许多其他安全功能提供了全面的支持。在Android开发中,BouncyCastle扮演着重要角色,特别是在处理SSL/TLS连接、加密通信以及生成和验证X.509...

    Java非对称加密解密(RSA)

    本篇将深入探讨Java中如何使用RSA进行非对称加密与解密,并结合Bouncy Castle库以增强其功能和安全性。 非对称加密,顾名思义,是指加密和解密使用不同的密钥,分为公钥和私钥。公钥可以公开,任何人都可以获取并...

    最详细的bouncycastle的jar包

    asn1 crypto i18n jce math mozilla ocsp openssl tsp util voms x509

Global site tag (gtag.js) - Google Analytics