0

我得到了一个简单的脚本,它很好地适用于 FF 和 Chrome,但 IE 也一直是 Partypooper。有什么想法/建议吗?

HTML

<div class="title">
    <p>Change is the law of life.<br />And those who look only to the past or present<br />are certain to miss the future.</p>
</div>

CSS

div.title {
position: fixed;
z-index: 10;
text-align:center;
margin:0 auto;
top: 230px;
width: 100%;
color: #FFFFFF;
}

JS

<script type="text/javascript">  
$(document).ready(function(){
var didScroll = false;
var icon = $(".title");
var $window = $(window);
$(window).scroll(function(){
didScroll = true;
});

window.setInterval(function () {
if (didScroll) {
  if (1-$window.scrollTop()/800 > -10) {
      icon.css({opacity: 1-$window.scrollTop()/800});
  }
  didScroll = false;
}
}, 50);
});
</script>
4

0 回答 0