Dtoast运用

6 篇文章 0 订阅

Dtoast作用 : 用来在网页上弹出提示错误内容
·1 .

导入common.js  内有  Dtoast() 或者之间将Dtoast写入js内
    function Dtoast(msg, id, time) {
    var time = time ? time : 2;
    var id = id ? id : '';
    $('.ui-toast').html(msg);
    var w = $('.ui-toast').width();
    if(w < 14) w = msg.length*14;
    $('.ui-toast').css('left', $(document).scrollLeft()+($(document).width()-w)/2 - 16);
    $('.ui-toast').fadeIn('fast', function() {
        setTimeout(function() {
            $('.ui-toast').fadeOut('slow', function() {
                if(id) $('#'+id).focus();
            });
        }, time*1000);
    });
}

2.
在网页上加入<div class="ui-toast"></div>

3.
加入css样式

<style>
.ui-toast {
    height: 300px;
    width: 500px;
    line-height: 450px;
    overflow: hidden;
    display: inline-block;
    padding: 0 16px;
    background: url({DT_SKIN}image/wap_wrong.png) 200px 50px no-repeat
        #000000;
    opacity: 0.8;
    color: #FFFFFF;
    border-radius: 15px;
    position: fixed;
    z-index: 99;
    top: 500px;
    font-size: 36px;
    display: none;
    text-align: center;
}
</style>

4.测试

        Dtoast("AAAAAAAAAAAAAAAAA");
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值