简体   繁体   English

使用Stellar.js移动背景图片

[英]Background image moves using Stellar.js

I'm developing a vertical scrolling website using Stellar.js. 我正在使用Stellar.js开发一个垂直滚动网站。 However, the background image I set for my first slide begins to shift as soon as I start scrolling to other pages. 但是,当我开始滚动到其他页面时,为第一张幻灯片设置的背景图像就开始移动。 How do I keep it fixed? 如何保持固定? Website: http://andrewgu12.kodingen.com/ 网站: http//andrewgu12.kodingen.com/

Screenshot (that blue area shouldn't be there): 屏幕截图(该蓝色区域不应存在):

在此处输入图片说明

CSS: CSS:

div#home {
    padding-top: 110px;
    background:url(../images/home_background.jpg) no-repeat fixed;
    max-height: 589px;
    background-attachment:fixed;
 }

Any help would be appreciated, thanks! 任何帮助,将不胜感激,谢谢!

While that will work, it will just kill all your scroll parallax effects - to disable parallax backgrounds and retain parallax elements, find this under the variable declaration area up top and set it to 'false': 尽管这将起作用,但是它将杀死所有滚动视差效果-要禁用视差背景并保留视差元素,请在变量声明区域的顶部找到它并将其设置为'false':

"parallaxBackgrounds: true," --> parallaxBackgrounds: false, “ parallaxBackgrounds:true,”-> parallaxBackgrounds:false,

You should find in the stellar.js script a section that says scrollProperty: 'scroll', I think you'll need to change it to scrollProperty: 'transform'. 您应该在stellar.js脚本中找到一段说scrollProperty:'scroll'的部分,我想您需要将其更改为scrollProperty:'transform'。 Not sure, try it out. 不确定,请尝试一下。

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

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