0

我对网站的视差滚动有疑问。现在它只在鼠标光标在红框内时有效。我整天都在努力解决它,所以我来这里寻求帮助。

    //$('html, body, #containerBox, #BackGround').mousewheel(function (e, delta)
$('html, body, *').mousewheel(function (e, delta)
{
    this.scrollLeft -= (delta * 10);
    e.preventDefault();
});

//Parallax scrolling

window.onscroll = displayDate;
window.onload = displayDate;

var scrollPosition = document.getElementById('panel1').scrollLeft;

if (scrollPosition > 80)
{
    document.getElementById("panel1Image").style.position = "relative";
    document.getElementById("panel1Image").style.top = (scrollPosition*1)+"px";
    document.getElementById("panel1Image").style.left = (scrollPosition*1)+"px";
}

请帮忙!谢谢!

http://jsfiddle.net/RpNyq/

4

0 回答 0