简体   繁体   English

parallax.js视差 - 滑块视差内容和图像

[英]parallax.js parallax-slider parallax content and image

http://pixelcog.github.io/parallax.js/ http://pixelcog.github.io/parallax.js/

Hello world! 你好,世界! I have a problem with the plugin above. 我上面的插件有问题。 I have managed to make several parallax backgrounds and can fill them with content no problem however in the documentation it mentions being able to use the parallax effect on content using the parallax-layer class and when I add that to my code the entire section becomes blank. 我已经设法制作了几个视差背景并且可以用内容填充它们没有问题但是在文档中它提到能够使用视差层类对内容使用视差效果,当我将它添加到我的代码时整个部分变成空白。 When I remove the parallax-layer div my code works again but ultimately I want to affect the content with the parallax effect just as I do with the image. 当我删除视差层div时,我的代码再次起作用但最终我想用视差效果影响内容,就像我对图像一样。 Anyone know what I'm doing wrong? 谁知道我做错了什么? Thanks :) 谢谢 :)

Heres the html... 继承人的HTML ...

<div class="parallax-window" data-parallax="scroll" data-image-src="background.jpg" style="padding:20px 30px;">
    <div class="parallax-slider">
<h1 style="color:rgba(255,255,255,1);font-size:10vw;margin:0;padding:0;text-shadow:-10px 10px 15px rgba(20,0,20,1);">Wally Gunn</h1>
    </div>
</div>

And the css... 而css ......

.parallax-window {
    min-height: 400px;
    background: transparent;
}

I have also pasted this script at the bottom of my body 我也把这个剧本粘贴在我的身体底部

<script>
$('.parallax-window').parallax({
naturalWidth: 600,
naturalHeight: 400});
</script>

I solved this problem... Use: 我解决了这个问题...使用:

<div class="parallax-window" data-parallax="scroll" data-image-src="https://tse1-mm.cn.bing.net/th?id=OIP.3iTMNkANw-FFI-x8vJqD4wHaDF&p=0&o=5&pid=1.1" data-z-index="-1">
    <div class="text">
        <h1>Simple Parallax Scrolling</h1>
    </div>
</div>

remember to set data-z-index to -1 , and elements in parallax-window will be shown. 记得将data-z-index-1 ,并显示parallax-window元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM