旋转的钢笔 2019-01-07 05: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 07: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条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部