[英]Problems with background image position on Stellar.js
I'm using stellar.js to add a parallax effect to a vertical scrolling website, but I'm having problems with the background positions. 我正在使用stellar.js为垂直滚动网站添加视差效果,但我遇到了背景位置问题。 When I use the class "data-stellar-background-ratio" to add the parallax effect on a div I can't set the background position to right via CSS.
当我使用“data-stellar-background-ratio”类在div上添加视差效果时,我无法通过CSS将背景位置设置为右侧。 All the background images just go to the left no matter what.
无论如何,所有背景图像都会向左移动。 I tried to use the position property plugin syntax available on the website, but it seems to break the parallax effect somehow.
我试图使用网站上提供的位置属性插件语法,但它似乎以某种方式打破了视差效果。 Can anybody help me?
有谁能够帮助我? Thank you!
谢谢!
I had the same issue. 我遇到过同样的问题。
In your jquery.stellar.js file change the stellar function so that horizontal scrolling is set to false (its set to true as default). 在jquery.stellar.js文件中更改stellar函数,以便将水平滚动设置为false(默认设置为true)。
$.stellar({
horizontalScrolling:false
// rest of function
});
Try changing scrollProperty
to transform
, like: 尝试更改
scrollProperty
进行transform
,例如:
scrollProperty: 'transform'
That worked for me. 这对我有用。
I had the same problem and already had horizontalScrolling:false
. 我有同样的问题,已经有
horizontalScrolling:false
。 Adding scrollProperty: 'transform'
resolved the issue for me. 添加
scrollProperty: 'transform'
为我解决了这个问题。
Having the same issue I tried adding 我尝试添加相同的问题
scrollProperty and horizontalScrolling
Though this resulted in my background not being loaded. 虽然这导致我的背景没有被加载。
Removing both properties and running Stellar like.. 删除这两个属性并运行Stellar就像..
$.stellar({}) instead of $.stellar()
(like on the Stellar site) (就像Stellar网站上一样)
Parallax is working like a charm. Parallax就像一个魅力。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.