旋转的钢笔 2019-01-07 13:55 采纳率: 54.5%
浏览 528
已采纳

css3 +angularjs 如何控制图片滑入滑出?

图片说明, 左下角有一张图片,如何控制点击它,它缓缓从右向左慢慢移除,
然后再从左向右移出另外一张图片或者div内容

 .coupon-layer{
    background-color:#263646;background-color: rgba(0,0,0,0.5);height: 175px;width: 100%; position: fixed;bottom: 0%; z-index: 12;
    .coupon-layer-pic{
      width: 980px;height:178px;margin: auto;position: relative;
      .coupon-combo{
        position: absolute;
        top: 15%;
        left: 0;
      }
      bottom-coupon-pic{
        transition: all linear 0.5s;
        height:294px;
        width: 121px;
      }
      .ng-hide {
        width: 0;
      }
      .coupon-close{
        background: url('../svg/close-gray.svg') no-repeat bottom;
        position: absolute;
        top: 10px;
        right: 0px;
        cursor: pointer;
      }
    }
  }

<div ng-controller="footLayerCtrl">
    <div class="bottom-coupon" ng-show="isShowCoupon"> <img class="bottom-coupon-pic" ng-click="showCoupon()" src="/dist/images/public/bottom-coupon.png" ></div>
    <div class="coupon-layer" ng-show="isShowLayer">
        <div class="coupon-layer-pic" >
            <a href=""><img class="coupon-combo" src="/dist/images/public/bottom-coupon-expand.png"></a>
            <img class="coupon-close" ng-click="closeCoupon()"  src="/dist/svg/close-gray.svg" width="30" height="30">
        </div>
    </div>
</div>


 .controller("footLayerCtrl",["$scope","$rootScope","$filter","factoryGlobal","mTranslate", function($scope,$rootScope,$filter,factoryGlobal,mTranslate) {
        $scope.isShowCoupon=true;
        $scope.isShowLayer=false;
        $scope.showCoupon=function () {
            $scope.isShowCoupon=false;
            $scope.isShowLayer=true;
        }
        $scope.closeCoupon=function () {
            $scope.isShowCoupon=true;
            $scope.isShowLayer=false;
        }
    }])
  • 写回答

2条回答 默认 最新

  • 旋转的钢笔 2019-01-08 15:53
    关注
    .bottom-coupon{
      background: url('../images/public/bottom-coupon.png') no-repeat bottom;
      position: fixed;
      bottom: 1%;
      z-index: 12;
      text-align: center;
      cursor: pointer;
      transform: translate3d(0, 0, 0);
      transition: transform 1s ease-in-out;
    }
    .bottom-coupon-extend{
      .bottom-coupon-1{
        -webkit-animation-delay: 1s;
        -moz-animation-delay: 1s;
        -o-animation-delay: 1s;
        animation-delay: 1s;
        transform: translate3d(-300px, 0, 0);
        transition: transform 0.5s ease-in-out;
      }
      .coupon-layer-1{
        -webkit-animation-delay: 2s;
        -moz-animation-delay: 2s;
        -o-animation-delay: 2s;
        animation-delay: 2s;
        transition: transform 0.5s ease-in-out;
        transform: translate3d(100%, 0, 0);
      }
      .coupon-layer-2{
        animation-delay:2s;
        -webkit-animation-delay:2s; /* Safari 和 Chrome */
        -moz-animation-delay: 2s;
        transition: transform 0.5s ease-in-out;
        transform: translate3d(-100%, 0, 0);
      }
    }
    
    .coupon-layer{
      background-color:#263646;background-color: rgba(0,0,0,0.5);height: 175px;width: 100%; position: fixed;bottom: 0%; z-index: 12;
      transition: transform 0.5s ease-in-out;
      transform: translate3d(0, 0, 0);
      .coupon-layer-pic{
        width: 980px;height:178px;margin: auto;position: relative;
        .coupon-combo{
          position: absolute;
          top: 15%;
          left: 0;
        }
        .bottom-coupon-pic{
          transition: all linear 0.5s;
          height:294px;
          width: 121px;
        }
        .ng-hide {
          width: 0;
        }
        .coupon-close{
          background: url('../svg/close-gray.svg') no-repeat bottom;
          position: absolute;
          top: 10px;
          right: 0px;
          cursor: pointer;
        }
      }
    }
    .fadeIn {
        -webkit-transform : translateX(120px);
       transform : translateX(120px);
       opacity: 1;
    }
    
     .controller("footLayerCtrl",["$scope","$rootScope","$filter","factoryGlobal","mTranslate", function($scope,$rootScope,$filter,factoryGlobal,mTranslate) {
            $scope.showCoupon=function () {
                angular.element(".bottom-coupon").addClass('bottom-coupon-1');
                angular.element(".coupon-layer").removeClass('coupon-layer-1');
                angular.element(".coupon-layer").removeClass('coupon-layer-2');
            }
            $scope.closeCoupon=function () {
                angular.element(".coupon-layer").addClass('coupon-layer-1');
                angular.element(".coupon-layer").addClass('coupon-layer-2');
                angular.element(".bottom-coupon").removeClass('bottom-coupon-1');
            }
    
        }])
    
    
            <div ng-controller="footLayerCtrl" class="bottom-coupon-extend">
            <div class="bottom-coupon "  > <img class="bottom-coupon-pic" ng-click="showCoupon()" src="/dist/images/public/bottom-coupon.png" ></div>
            <div class="coupon-layer coupon-layer-2">
                <div class="coupon-layer-pic" >
                    <a href="javascript:void(0)" ng-click="isLogin('/public/user-login.html')"><img class="coupon-combo" src="/dist/images/public/bottom-coupon-expand.png"  ></a>
                    <img class="coupon-close" ng-click="closeCoupon()"  src="/dist/svg/close-gray.svg" width="30" height="30">
                </div>
            </div>
        </div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀