skrollr:改变职位不起作用

时间:2014-02-28 12:46:17

标签: html css skrollr

我正在尝试使用skrollr为屏幕左侧的div(左:100%)设置左边的动画:25%,同时从50%的不透明度渐变为100%。像这样简单:

    <html>
    <head>
    </head>
    <body>
    <div style="height:500px">
    <br><br><br><br><br><br><br>

    <div data-0="left:100%; opacity:.2" data-50="left:25%; opacity:1">
    GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG<br>
    GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG<br>
    GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG<br>
    GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG<br>
    GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG<br>
    GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG<br>
    </div>

    </div>

        <script type="text/javascript" src="js/skrollr.min.js"></script>

        <script type="text/javascript">
        var s = skrollr.init({
        });
        </script>
   </body>
   </html>

不透明度变化效果很好。但是,位置变化对我来说似乎不起作用(Chrome,Firefox和Safari) - 文本保持稳定位于左侧:0%。有什么我想念的吗?

1 个答案:

答案 0 :(得分:1)

由于你没有发布任何CSS,我认为没有。如果是这种情况,则该元素为position ed static ally,在这种情况下它会忽略left.

您需要定位relativeabsolutefixed

这与skrollr和一个简单的CSS事物无关。