小编Cia*_*nan的帖子

在Golang中午运行代码

是否可以每天中午执行代码?该程序正在处理用户输入剩余的运行时间,但需要在中午运行一个函数来输出一些文本.这样做最有效的方法是什么?

time automation go

2
推荐指数
1
解决办法
3762
查看次数

在jquery中更改多个div位置

我试图使用jquery .each函数更改5 div的left/top值.目前,div在彼此之上产生,然后不受jquery的影响,在这个片段中也是如此.我需要更改什么才能让div移动到屏幕上的随机位置.

$(function() {
  var docHeight = $(window).height(),
    docWidth = $(window).width(),
    $div = $('.randomSpawn'),
    divWidth = $div.width(),
    divHeight = $div.height(),
    heightMax = docHeight - divHeight,
    widthMax = docWidth - divWidth;
  $div.each(function() {
    $(this).css("left", "Math.floor( Math.random() * widthMax )");
    $(this).css("top", "Math.floor( Math.random() * heightMax )");
  });
});
Run Code Online (Sandbox Code Playgroud)
.randomSpawn {
  position: fixed;
  background-color: black;
  display: block;
  top: 0;
  left: 0;
  width: 100px;
  height: 100px;
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="1" class="randomSpawn"></div>
<div id="2" class="randomSpawn"></div>
<div id="3" class="randomSpawn"></div>
<div id="4" class="randomSpawn"></div>
<div id="5" …
Run Code Online (Sandbox Code Playgroud)

html css jquery

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

标签 统计

automation ×1

css ×1

go ×1

html ×1

jquery ×1

time ×1