JQ-- picture pop-up effect (timed pop-up picture), toggle

1, a hide () and show () method to hide and display HTML elements (here IMG)

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <Title> Timing pop - Pictures of the pop-up effect </ title>
        <script type="text/javascript" src="../js/jquery-1.8.3.js" ></script>
        <script>
            $(function(){
                time = setInterval("showAd()",3000);
            });
            function showAd(){
                $("#img").show(4000);
                clearInterval(time);
                time = setInterval("hiddenAd()",3000);
            }
            
            function hiddenAd(){
                $("#img").hide(8000);
                clearInterval(time);
            }
        </script>
    </head>
    <body>
        <div>
            <img src="../img/1.jpg" width="100%" style="display: none" id="img"/>
        </div>
    </body>
</html>

To achieve the effect pop-up picture of when using the function JQ, not only can be set to pop up and disappear pictures of speed, you can also select different functions on the pop-up effect change:

 

Light fade into effect as follows:

 

 

2, toggle the use of:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Toggle的使用</title>
        <script type="text/javascript" src="../js/jquery-1.8.3.js" ></script>
        <script>
        $(function(){
          $("button").click(function(){
            $("p").toggle();
          });
        });
        </script>
    </head>
    <body>
        <p>新年快乐!</p>
        <button>隐藏/显示文字</button>
    </body>
</html>

 

 

 

Guess you like

Origin www.cnblogs.com/zhai1997/p/12233380.html