滚动文本选框无法在IE和Edge中工作

时间:2016-07-01 16:35:53

标签: javascript jquery html css

我有一个滚动选框。它在Chrome中运行完美,但在IE和Edge

中运行不佳

选取框没有要显示的任何硬编码文本,因为文本是从MySQL数据库中选择的。 select查询和php变量正确完成,因为它适用于Chrome

AJAX

function scrollhandler() {
   $.getJSON("check_time_scroll.php", function(update) {
    if (update.count===true) {
    $("#scrolltext").load('unifoscrolltext.php');
    } 
});
}
setInterval(scrollhandler, 10000);
</script>

function calcSpeed(speed) {
  // Time = Distance/Speed
  var spanSelector = document.querySelectorAll('.marquee span'),
      i;
  for (i = 0; i < spanSelector.length; i++) {
    var spanLength = spanSelector[i].offsetWidth,
        timeTaken = spanLength / speed;
    spanSelector[i].style.animation = "marquee linear infinite " + timeTaken + "s";
  }
}
calcSpeed(42);
/* Make it a marquee */
.marquee {
  width: 100%;
  left: 0px;
  position: fixed;
  white-space: nowrap;
  overflow: hidden;
  background-color: #000000;
  color: white;
  font: 50px Verdana;
  display: inline-block;
}
.marquee span {
  display: inline-block;
  padding-left: 100%;
  text-indent: 0;
  background-color: #000000;
  color: white;
}
/* Make it move */
@keyframes marquee {
  0% {
    transform: translate(10%, 0);
  }
  100% {
    transform: translate(-100%, 0);
  }
}
/* Make it pretty */
.scroll {
  padding-left: 1.5em;
  position: fixed;
  font: 50px Verdana;
  bottom: 0px;
  color: white;
  left: 0px;
  height: 10%;
}
<div class="marquee">
  <span id="scrolltext">Hello world</span>
</div>

0 个答案:

没有答案
相关问题