stonehenge.js是一个轻量级的jQuery插件,用于创建自动、水平、可拖动和可滑动的旋转木马/滚动器,以平滑和交互式地展示您的内容。
1.将jQuery库和stonehenge.js插件的文件插入到HTML文档中。
- <link rel="stylesheet" href="/path/to/dist/stonehenge.css">
- <script src="/path/to/cdn/jquery.min.js"></script>
- <script src="/path/to/dist/stonehenge.js"></script>
2.将您的内容添加到巨石阵容器中,如下所示:
- <div class="stonehenge">
- <div>Item 1</div>
- <div>Item 2</div>
- <div>Item 3</div>
- ... more items here ...
- </div>
3.调用顶部容器上的函数来生成一个基本的转盘/滑动器/滚动器。
- $(function(){
- $('.stonehenge').stonehenge();
- });
4.配置灼热动画。
- $('.stonehenge').stonehenge({
- // animation speed
- speed: 1.0,
- // config the auto-scroll behavior
- autoscroll: false,
- autoscrollOnce: true,
- autoscrollSpeed: 20,
- autoscrollPeriod: 500,
- autoscrollEasing: 'linear',
- });