jquery利用show和hide方法制作图片特效

来源:互联网 发布:mac windows10截图图片 编辑:程序博客网 时间:2024/05/02 14:18
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <style type="text/css">
    #img1
    {
        width:500px;
        height:500px;
        display:none;
        }
    </style>
    <script src="jquery-1.9.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $('#Button1').click(function () {
                $('#img1').show(5000);
            })
            $('#img1').click(function () {
                //                $('#img1').css('width', '100');
                //                $('#img1').css('height', '100');
                //$('#img1').hide(10000);
                $('#img1').fadeOut(5000);//和hide的用法一样,效果不同
            })
        })
    </script>
</head>
<body>
    <img id="img1" alt="" src="images/10.jpg" />
    <input id="Button1" type="button" value="展开图片" />
    <input id="Button2" type="button" value="收缩图片" />
       
</body>
</html>
原创粉丝点击