2017-04-10 62 views
0

我想使用Stellar.js在背景图像上产生一个简单的视差效应......我做错了什么?恒星视差效应不起作用

我的HTML:

... 
<div id="parallax" data-stellar-background-ratio="2"> 
<p>Content</p> 
</div> 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> 

<script src="js/jquery.stellar.min.js"></script> 

<script> 
    $("#parallax").stellar(); 
</script> 

</body> 
</html> 

CSS

#parallax { 
    background-image: url("../img/bg.jpg"); 
    height: 500px; 
} 

回答

0

我有点晚了,但无论如何,尝试使用自带的恒星压缩了jQuery,并改变你的背景附件固定。