Scala.JS中的粘性卷轴

时间:2017-07-06 16:58:54

标签: scala scala.js

我正在尝试在Scala.JS中做同样的答案:https://stackoverflow.com/a/21067431

根据他的例子:http://jsfiddle.net/dotnetCarpenter/KpM5j/
我试着在这里重做:https://scalafiddle.io/sf/gKgxQY0/3277

import scalatags.JsDom.all._
import scala.concurrent.duration._
import org.scalajs.dom

println(div(id := "logs", style := "height: 100px"))

js.timers.setInterval(1.millisecond) {
  val logs = dom.document.getElementById("logs")

  val isScrolledToBottom = logs.scrollHeight - logs.clientHeight <= logs.scrollTop + 1

  val child = dom.document.createElement("div")
  child.innerHTML = s"isScrolledToBottom: $isScrolledToBottom"
  logs.appendChild(child)

  if (isScrolledToBottom) logs.scrollTop = logs.scrollHeight - logs.clientHeight

  val child2 = dom.document.createElement("div")
  child2.innerHTML = s"logs.scrollTop: ${logs.scrollTop}"
  logs.appendChild(child2)
}

有没有人知道为什么Scala.JS版本不起作用?

干杯

1 个答案:

答案 0 :(得分:0)

好的,因为我没有在 <select name="extension" id="extension" class="input-name"> <?php $query = "SELECT ext FROM user WHERE account=100"; //Query for users for selected account. $results = mysqli_query($con, $query); while($user= $results ->fetch_assoc()){ ?> <option value="<?php echo $user["ext"]; ?>"><?php echo $users["ext"];?></option> <?php } ?> </select> 上添加overflow:autohttps://scalafiddle.io/sf/gKgxQY0/3294

div