为了账号安全,请及时绑定邮箱和手机立即绑定

任务7 .bg:not(:target) 做完之后为什么没有效果

和任务六做完相比较,并没有任何区别啊

       
       
            /*任务六、点击综略图,切换背景图*/
            /*背景图从左向右出现*/
            .slideLeft:target{
             z-index: 100;
             -webkit-animation-name: slideLeft;
             -webkit-animation-duration: 1s;
             -webkit-animation-iteration-count: 1;
             -moz-animation-name: slideLeft;
             -moz-animation-duration: 1s;
             -moz-animation-iteration-count: 1;
             -ms-animation-name: slideLeft;
             -ms-animation-duration: 1s;
             -ms-animation-iteration-count: 1;
             -o-animation-name: slideLeft;
             -o-animation-duration: 1s;
             -o-animation-iteration-count: 1;
             animation-name: slideLeft;
             animation-duration: 1s;
             animation-iteration-count: 1;
            }
            /*背景图从下向上出现*/
           .slideBottom:target{
             z-index: 100;
            
             -webkit-animation-name: slideBottom;
             -webkit-animation-duration: 1s;
             -webkit-animation-iteration-count: 1;
             -moz-animation-name: slideBottom;
             -moz-animation-duration: 1s;
             -moz-animation-iteration-count: 1;
             -ms-animation-name: slideBottom;
             -ms-animation-duration: 1s;
             -ms-animation-iteration-count: 1;
             -o-animation-name: slideBottom;
             -o-animation-duration: 1s;
             -o-animation-iteration-count: 1;
            animation-name: slideBottom;
             animation-duration: 1s;
             animation-iteration-count: 1;
            }
            /*背景图由小到大出现*/
            .zoomIn:target{
             z-index: 100;
             -webkit-animation-name: zoomIn;
             -webkit-animation-duration: 1s;
             -webkit-animation-iteration-count: 1;
             -moz-animation-name: zoomIn;
             -moz-animation-duration: 1s;
             -moz-animation-iteration-count: 1;
             -ms-animation-name: zoomIn;
             -ms-animation-duration: 1s;
             -ms-animation-iteration-count: 1;
             -o-animation-name: zoomIn;
             -o-animation-duration: 1s;
             -o-animation-iteration-count: 1;
             animation-name: zoomIn;
             animation-duration: 1s;
             animation-iteration-count: 1;
            }
            
            /*背景图由大到小出现*/
            .zoomOut:target{
             z-index: 100;
             -webkit-animation-name: zoomOut;
             -webkit-animation-duration: 1s;
             -webkit-animation-iteration-count: 1;
             -moz-animation-name: zoomOut;
             -moz-animation-duration: 1s;
             -moz-animation-iteration-count: 1;
             -ms-animation-name: zoomOut;
             -ms-animation-duration: 1s;
             -ms-animation-iteration-count: 1;
             -o-animation-name: zoomOut;
             -o-animation-duration: 1s;
             -o-animation-iteration-count: 1;
             animation-name: zoomOut;
             animation-duration: 1s;
             animation-iteration-count: 1;
            }
            
            /*背景图旋转出现*/
            .rotate:target{
             z-index: 100;
             -webkit-animation-name: rotate;
             -webkit-animation-duration: 1s;
             -webkit-animation-iteration-count: 1;
             -moz-animation-name: rotate;
             -moz-animation-duration: 1s;
             -moz-animation-iteration-count: 1;
             -ms-animation-name: rotate;
             -ms-animation-duration: 1s;
             -ms-animation-iteration-count: 1;
             -o-animation-name: rotate;
             -o-animation-duration: 1s;
             -o-animation-iteration-count: 1;
             animation-name: rotate;
             animation-duration: 1s;
             animation-iteration-count: 1;
            }
            /*任务七、设置不显示的背景图层级*/
            /* Not Target */
            
             .bg:not(:target){
             -webkit-animation-name: notTarget;
             -webkit-animation-duration: 1s;
             -webkit-animation-iteration-count: 1;
             -moz-animation-name: notTarget;
             -moz-animation-duration: 1s;
             -moz-animation-iteration-count: 1;
             -ms-animation-name: notTarget;
             -ms-animation-duration: 1s;
             -ms-animation-iteration-count: 1;
             -o-animation-name: notTarget;
             -o-animation-duration: 1s;
             -o-animation-iteration-count: 1;
             animation-name: notTarget;
             animation-duration: 1s;
             animation-iteration-count: 1;
            }


正在回答

4 回答

你如果不加img:not(:target)的话你会发现,在点击更换背景图片的一瞬间,更换前的那张图片会换成最后一张图片,然后同时更换你点击的那张图片,也就是说它们的显示层级有问题,前后层级不对。

0 回复 有任何疑惑可以回复我~

试试 img.bg:not(:target)

0 回复 有任何疑惑可以回复我~

只是复原其他的层级为1只把当前的层级设置为100

0 回复 有任何疑惑可以回复我~

代码贴出来看看

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

任务7 .bg:not(:target) 做完之后为什么没有效果

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信