【问题标题】:angularjs:-Image loader coming on the first divangularjs:-第一个 div 上的图像加载器
【发布时间】:2016-02-08 12:30:44
【问题描述】:

您好,我想实现一个加载器,当用户点击配置文件时,它应该在给定时间后隐藏。我实际上已经实现了一个超时功能,只要用户点击按钮,div 就会在特定时间后隐藏.

加载程序在左侧而不是在导致 UI 出现问题的相应 div 上

下面是我的代码 sn-p:-

   $scope.totalNumberOfProfile = totalNumberOfProfile;
        $scope.categoryOfProfile = "Member Who Shortlisted You";

        $scope.custom = true;
        $scope.alertDisplayed = false;
        $scope.connect = function(profile) {

            $timeout(function() {
                $scope.totalNumberOfProfile--;
                profile.show = false;
                profile.status = "connect";
                document.getElementById("myDiv").style.display="block";
                //console.log($scope.totalNumberOfProfile);
                if ($scope.totalNumberOfProfile == 0) {
                    $scope.custom = false;
                    $scope.alertDisplayed = true;
                    $timeout(function() {
                        $scope.alertDisplayed = false;
                    }, 2000)
                };
            }, 600)



        };

代码的html是:-

<div owl-carousel-item="" ng-repeat="profile in updatedProfile | filter:isoffice" ng-if="profile.show">

                    <!-- Panel in owl carousel -->
                    <div id="discover " ng-class="discover_image" ng-switch on="profile.member">

                        <li style="margin-left:0px; margin-right:0px">
                            <div class="thumbnail_photo">
                                <button class="close" ng-click="remove(profile)"><span class="glyphicon glyphicon-remove"></span></button>
                                <a href="#/discover/{{profile.basic.username}} " target="_blank"><span class="discover_pic_container" style="background:url({{profile.photo_details.photos[0].domain_name+profile.photo_details.photos[0].medium}}) no-repeat center top"></span></a>
                                <div class="discover_transparent">
                                    <div class="discover_name">{{profile.basic.display_name }}</div>
                                </div>

                            </div>
                            <div class="recent_join_user_info">23 yrs, 5'4", Gujarati, Hindu Mumbai, India</div>
                            <!--                            <button class="discover_connect_btn btn btn-lg " ng-click="connect(profile)" ng-if="profile.member">Connect</button>-->

                            <button ng-class="{'discover_premium btn btn-lg': userLogin == 2, 'discover_connect_btn btn btn-lg': userLogin == 3}"  ng-click="connect(profile)" >{{userinfor}}</button>
<div id = "myDiv" style="display:none"><img id = "myImage" src = "images/725.gif"></div>

                        </li>
                    </div>

                </div>

我正在尝试实现的 gif 文件名为 725.gif..请帮帮我..谢谢

【问题讨论】:

    标签: javascript jquery angularjs timeout


    【解决方案1】:

    你应该在你的加载器 div 中添加这些 CSS 属性。

    #myDiv {
         width: 100%;
         height: 100%;
         position: absolute;
         top: 0;
         left: 0;
         z-index: 10;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-02-26
      • 2018-02-20
      • 2020-12-24
      • 2014-01-04
      • 1970-01-01
      • 2016-06-01
      • 1970-01-01
      相关资源
      最近更新 更多