我试图使用Stellar.js脚本来应用视差效果。
这是马克·达格利什网站http://markdalgleish.com/projects/stellar.js/demos/backgrounds.html的官方例子
即使在复制和粘贴示例中的源代码时,它们也会出现在固定位置,而不是对每个图像都有轻微的滚动效果。
我做错了什么?
发布于 2014-04-19 15:16:10
<html>
<head>
<!-- Title, CSS, and other stuff -->
</head>
<body>
<!-- Content here with right stellar attributes -- >
...
<!-- At the end of body load the scripts, and run initialisation -->
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="YOUR_PATH_TO_STELLAR/jquery.stellar.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(window).stellar({
scrollProperty: 'scroll',
horizontalScrolling: false,
positionProperty: 'position'
});
</script>
</body>
</html>发布于 2015-06-28 16:12:39
在我的stellar.js视差滚动不初始化的情况下,直到我的浏览器窗口被调整大小。我发现$.stellar('refresh');似乎解决了这个问题。(使用AngularJS)
angular.module('ForeverLeather').controller('HomeCtrl', ['$scope', function($scope) {
$(window).stellar({
horizontalScrolling: false,
verticalOffset: 0,
horizontalOffset: 0,
responsive: true,
}).stellar('refresh');
}]);https://stackoverflow.com/questions/23171189
复制相似问题