插件 jQuery.Revolver.js 中文API文档

🌙
手机阅读
本文目录结构

插件 jQuery.Revolver.js 中文API文档 https://github.com/revolverjs/revolverjs

Revolver Build Status Code Climate

Revolver is a javascript library to help you build your own content slider. It has a sensible API (seriously, go check it out) that helps you get from mockup to reality with less friction than most of the other “cookie-cutter” sliders out there.

One important difference is, Revolver is a much lower component than most others. It’s more of a framework than it is a complete solution. So, naturally, hand-writing a little javascript comes with the territory. Let’s get started!

Installation

The recommended way to install Revolver is with Bower.

bower install revolver

It will resolve all of Revolver’s dependencies for you, no need to go and download those separately. If you are unfamiliar with it, I highly recommend you take a look!

Of course, you can still take the ol' fashioned approach and download/unzip anywhere in your project. Just make sure you also do the same for Revolver’s hard dependencies: Lodash and Bean.

Usage

There are only two things that are required to instantiate Revolver:

  1. Container: via container or containerSelector options.
  2. Slides: via slides or slidesSelector options.
Using DOM Nodes
var mySlideContainer = document.getElementById('slidesContainer');
var mySlides = mySlideContainer.getElementsByClassName('slide');

var mySlider = new Revolver({container: mySlideContainer, slides: mySlides});
Using Selectors
var mySlider = new Revolver({containerSelector: '#slidesContainer', slideSelector: '.slide'});

You may also implement any combination of the two methods.

For more usage information, please refer to the API.

Examples

Because of Revolver’s unopinionated philosophy, it does very little out of the box and usually requires some small amount of customization to hit the sweet spot. Here are a few ideas to get you started:

Or make your own custom transition.

Extensions

Making a Custom Transition

When composing your own custom slide transitions, it is recommended that you use a good animation library versus using CSS3 animation. But not all animation libraries are created equal. We recommend using one of the following:

Or, if not one of these, choose one that uses requestAnimationFrame.

Contributing

Please review the guidelines for contributing before opening a pull request. It includes docs for building, testing, and handling dependencies.


AXIHE / 精选资源

浏览全部教程

面试题

学习网站

前端培训
自己甄别

前端书籍

关于朱安邦

我叫 朱安邦,阿西河的站长,在杭州。

以前是一名平面设计师,后来开始接接触前端开发,主要研究前端技术中的JS方向。

业余时间我喜欢分享和交流自己的技术,欢迎大家关注我的 Bilibili

关注我: Github / 知乎

目前重心已经放在研究区块链上面了

我叫朱安邦,阿西河的站长

目前在杭州从事区块链周边的开发工作,机械专业,以前从事平面设计工作。

2014年底脱产在老家自学6个月的前端技术,自学期间几乎从未出过家门,最终找到了满意的前端工作。更多>