jquery写的slideLeft,slideRight

本文介绍了一种使用jQuery实现的自定义动画效果——元素从左侧滑入和滑出的显示与隐藏功能。通过扩展jQuery的方法,实现了元素宽度及相关内边距、外边距的动画效果。示例中演示了如何在页面加载完成后自动触发这些动画。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<html>    
<head>    
<script type="text/javascript" src="jquery.1.2.6.js"></script>    
<script type="text/javascript">    
    jQuery.fn.slideLeftHide = function( speed, callback ) {    
        this.animate({    
            width : "hide",    
            paddingLeft : "hide",    
            paddingRight : "hide",    
            marginLeft : "hide",    
            marginRight : "hide"    
        }, speed, callback );    
    };    
    jQuery.fn.slideLeftShow = function( speed, callback ) {    
        this.animate({    
            width : "show",    
            paddingLeft : "show",    
            paddingRight : "show",    
            marginLeft : "show",    
            marginRight : "show"    
        }, speed, callback );    
    };    
</script>    
<script type="text/javascript">    
    $(function() {    
        $(".title_bar").slideLeftHide(4000);    
        $(".title_bar").slideLeftShow(4000);    
    });    
</script>    
    
    
</head>    
<body>    
    
    <div class="title_bar">    
    <img src="recruitment.png" border="0"    
             />          
    </div>    
</body>    
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值