我已经安装了Stellar插件,并让它像这样工作:
$.stellar({
horizontalScrolling: false,
verticalOffset: -600
});但是我有2个不同的元素和2个不同的背景图像。我需要将第二个元素的verticalOffset设置为200,而不是上面的-600。
为此,我补充说:
$('.photo2').stellar({
horizontalScrolling: false,
verticalOffset: 200
});但这并不起作用--第一个函数只是覆盖了它。
如果我把它们分开,就像这样:
$('.photo1').stellar({
horizontalScrolling: false,
verticalOffset: -600
});
$('.photo2').stellar({
horizontalScrolling: false,
verticalOffset: 200
});任何东西都不起作用。
有没有人知道用Stellar设置多个元素的正确方法?
发布于 2013-12-29 17:15:19
您应该能够通过向元素添加数据属性来实现这一点:
<div class="photo2" data-stellar-vertical-offset="200"></div>您可以在文档中找到更多信息:http://markdalgleish.com/projects/stellar.js/docs/
乔迪
https://stackoverflow.com/questions/20800060
复制相似问题