Home > Web Front-end > JS Tutorial > jQuery implements click events for movement and gradient effects_jquery

jQuery implements click events for movement and gradient effects_jquery

WBOY
Release: 2016-05-16 16:12:50
Original
1229 people have browsed it

Look at the code first:

Copy code The code is as follows:



   
       
       
       
   


   
       
       

        <script> <br>             $(document).ready(function(){<br>               $("button").click(function(){<br>                 var div=$(".box");<br>                 div.animate({height:'200px',opacity:'0.4'},"slow");<br>                 div.animate({width:'200px',opacity:'0.8'},"slow");<br>                 div.animate({height:'100px',opacity:'0.4'},"slow");<br>                 div.animate({width:'100px',opacity:'0.8'},"slow");<br>                 div.animate({right:'100px',opacity:'0.8'},"slow");<br>                 div.animate({bottom:'100px',opacity:'0.8'},"slow");<br>                 div.animate({left:'100px',opacity:'0.8'},"slow");<br>                 div.animate({top:'100px',opacity:'0.8'},"slow");<br>               });<br>             });<br>         </script>
        <script><br>             $(document).ready(function(){<br>                 $("button").click(function(){<br>                     var div=$(".box");<br>                         div.animate({height:'300px',opacity:'0.4'},"slow");<br>                         div.animate({width:'300px',opacity:'0.8'},"slow");<br>                         div.animate({height:'100px',opacity:'0.4'},"slow");<br>                         div.animate({width:'100px',opacity:'0.8'},"slow");<br>                     });<br>                 });<br>             });<br>         </script>
   

.animate  事件,是这个 里面的新的东西。解释起来就是  使div 块儿  变得有灵魂 可以移动。

 Tips:

1、click 事件的  点击节点的选择

2、通过 var div=$(".box")  来选择需要控制的 css 属性

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template