启明星在这里 2019-04-22 15:17 采纳率: 0%
浏览 2703

js创建div,class样式无效

在vue里创建div,给一个class,渲染到openlayers地图上,css里给class添加动画不生效

var point_div = document.createElement("div");
point_div.className = "anchorImg";
point_overlay = new ol.Overlay({
        element: point_div,
        positioning: "bottom-center"
      });
      map.addOverlay(point_overlay);
      point_overlay.setPosition(coor);
    })

css动画

.anchorImg {
  height: 50px;
  width: 50px;
  border-radius: 25px;
  background: rgba(255, 0, 0, 1);
  transform: scale(0);
  animation: myfirst 2s;
  animation-iteration-count: infinite;
}

@keyframes myfirst {
  to {
    transform: scale(2);
    background: rgba(0, 0, 0, 0);
  }
}
  • 写回答

3条回答 默认 最新

  • sinat_39403108 2019-04-22 17:00
    关注

    point_div.className = "anchorImg";vue里面不是className,直接point_div.class = "anchorImg";或者point_div.style="你的style布局"

    评论

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型