欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery實現(xiàn)移動 和 漸變特效的點擊事件

 更新時間:2015年02月26日 11:06:26   投稿:hebedich  
這里給大家分享的是一則使用jQuery實現(xiàn)移動和漸變特效的點擊事件效果,非常簡單實用,這里推薦給大家。

先看代碼:

復(fù)制代碼 代碼如下:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <script src="js/jquery.js"></script>
    </head>
<style>
body{font-family: "微軟雅黑";width: 980px; margin: 0 auto; text-align: center;}
    .box{
        width: 300px;
        height: 300px;
        background: green;
        border: 1px solid #e6e6e6;
        margintop: 50px;
        line-height: 200px;
        position: absolute;
    }
button{
    border: none;
    background: green;   
    width: 100px;
    height: 50px;
    line-height: 50px;
    color: #fff;
    font-size: 16px;
    margin-top: 50px;
    }
</style>
    <body>
        <button>點擊開始動畫</button>
        <div class="box" ></div>
        <script>
            $(document).ready(function(){
              $("button").click(function(){
                var div=$(".box");
                div.animate({height:'200px',opacity:'0.4'},"slow");
                div.animate({width:'200px',opacity:'0.8'},"slow");
                div.animate({height:'100px',opacity:'0.4'},"slow");
                div.animate({width:'100px',opacity:'0.8'},"slow");
                div.animate({right:'100px',opacity:'0.8'},"slow");
                div.animate({bottom:'100px',opacity:'0.8'},"slow");
                div.animate({left:'100px',opacity:'0.8'},"slow");
                div.animate({top:'100px',opacity:'0.8'},"slow");
              });
            });
        </script>
        <script>
            $(document).ready(function(){
                $("button").click(function(){
                    var div=$(".box");
                        div.animate({height:'300px',opacity:'0.4'},"slow");
                        div.animate({width:'300px',opacity:'0.8'},"slow");
                        div.animate({height:'100px',opacity:'0.4'},"slow");
                        div.animate({width:'100px',opacity:'0.8'},"slow");
                    });
                });
            });
        </script>
    </body>
</html>

.animate  事件,是這個 里面的新的東西。解釋起來就是  使div 塊兒  變得有靈魂 可以移動。

 Tips:

1、click 事件的  點擊節(jié)點的選擇

2、通過 var div=$(".box")  來選擇需要控制的 css 屬性

剩下的就要靠 自己去敲代碼,看效果 去理解其中的 意思。

相關(guān)文章

最新評論