我的jarallax与我的网页配合得很好。问题是图像动画非常糟糕(每个滚动的像素数)。
我已尝试实施此代码
<script>
$('#Wrapper').bind('mousewheel', function (e) {
if (!(e.originalEvent.wheelDelta == 120)) {
var top = parseInt($("#child").css("top"));
$("#child").css("top", (top - 100) + "px");
top = parseInt($("#child").css("top"));
if (top <= -500) {
setTimeout(function () {
$("#child").css("top", "-500px");
}, 100);
}
} else {
var top = parseInt($("#child").css("top"));
$("#child").css("top", (top + 100) + "px");
top = parseInt($("#child").css("top"));
if (top >= 0) {
setTimeout(function () {
$("#child").css("top", "0");
}, 100);
}
}
});
</script>
和html
<body onload="init()">
<div id="Wrapper">
<div id="child">
<--!> Content </-->
问题是,它不是用滚动动画。这是一个单页网站。
我还尝试了一些jquery鼠标插件,我似乎没有做到这一点。任何帮助,将不胜感激。