• loading动画的实现


    basic.css  定义loading样式 
    
    .loading {
        background: url(/NewImg/loading.gif) no-repeat center;
    }
    
    common.js  Loading方法
    
     var LoadingShow = function (target) {
        if (!$(target).hasClass('loading')) {
            $(target).addClass('loading');
        }
     }
     var LoadingHide = function (target) {
        if ($(target).hasClass('loading')) {
            $(target).removeClass('loading');
        }
     }
    
    
    
    //调用
    $.ajax({
                type: 'POST',
                url: '/NewHandler/HotelHandler.ashx',
                data: subdata,
                dataType: 'JSON',
                beforeSend: function () {
                    $('.hotel_list').html('');
                    LoadingShow('.hotel_list');
           },
                success: function (result) {
                    if (result.state == 1) {
                        tempdata = result.rows;
                        var HotelHtml = new EJS({ element: 'HotelTemplate' }).render(result.rows);
                        LoadingHide('.hotel_list');
                        $('.hotel_list').html(HotelHtml);
    
                        //显示每日房价
                        $('.btn_booking_pri').mouseover(function (e) {
                            $('.edayPrice').show(300).css({
                                top: e.pageY + 10,
                                left: e.clientX - 500
                            })
                        }).mouseout(function () {
                            $('.edayPrice').hide()
                        });
                        //每个酒店显示3条可卖房间
                        for (var i = 0; i < $('.roomItems').length; i++) {
                            var currul = $('.roomItems')[i];
                            if ($(currul).find('.btn_booking').size() > 3) {
                                $(currul).find('.btn_booking:gt(2)').parent().parent().parent().addClass('none');
                            } else {
                                $(currul).next('.fold').addClass('none');
                            }
                        };
                    }
                    else {
                        alert(result.msg);
                    }
                },
                error: function (e) {
                    alert("网络错误");
                }
            })
    
        }
  • 相关阅读:
    MIPAV
    SPM12manual,统计部分(8-10)笔记
    Django中ORM介绍和字段及字段参数
    Django的路由系统
    django 连接mysql报错
    django启动创建用户失败
    django ORM操作
    Django创建App报错
    Web框架
    Bootstrap框架(组件)
  • 原文地址:https://www.cnblogs.com/vscss/p/5673280.html
Copyright © 2020-2023  润新知