小编Nit*_*ish的帖子

CSS动画 - 位置到原始位置

我今天想玩css动画.

所以我的基本想法是创建四个圆圈然后当用户点击该圆圈然后它应该到页面的中心然后它应该变成其他形状.

所以我使用了变换和动画属性.

这是我写的代码到现在为止.

$(".circle").click(function(){
  if($(this).hasClass('centerOfPage')){
    $(this).removeClass('centerOfPage');
  }else{
    $(this).addClass('centerOfPage');
  }
});
Run Code Online (Sandbox Code Playgroud)
.circle{
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin: 10px;
}
.one{
  background-color: red;
}
.two{
  background-color: blue;
}
.three{
  background-color: yellow;
}
.four{
  background-color: green;
}

 .centerOfPage{
    position: fixed;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 5%;
   -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    animation : centerOfPageAnimate 3s;
   
}
@keyframes centerOfPageAnimate {
  0% {
    top: 0%;
    left: 0%;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    transform: translate(0, 0);    
  } …
Run Code Online (Sandbox Code Playgroud)

css css3 css-transitions css-animations

7
推荐指数
1
解决办法
845
查看次数

将大数字字符串转换为数字

我可以用什么方法将 16 位数字和 2 个分数值的字符串转换为数字?

目前,当我尝试转换时Number('1234567890123456.12')将变为1234567890123456. 分数值将消失。

我只是想在不使用任何第三方库的情况下确认我可以将此字符串转换为数字吗?

javascript numbers typescript

3
推荐指数
1
解决办法
8172
查看次数