Skip to content

Commit

Permalink
add test specs & support cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
jjf001 committed Feb 2, 2015
1 parent 5b0f285 commit 83bebaf
Show file tree
Hide file tree
Showing 11 changed files with 11,614 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</script>
```

同样,也`swiper.js`也支持`AMD`规范,可以用`requirejs`进行加载。
同样,也`swiper.js`也支持`AMD``CMD`规范,可以用`requirejs``seajs`进行加载。

```html
<script src="path/to/require.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion dist/swiper.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 11 additions & 12 deletions src/swiper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
* Created by jfengjiang on 2015/1/13.
*/

(function(w, d){

(function(name, definition) {
if (typeof define === 'function'){
define(definition);
} else {
this[name] = definition();
}
})('Swiper', function(){

/**
*
Expand All @@ -21,7 +28,7 @@
this._offset = 0;
this._eventHandlers = {};

this.$container = d.querySelector(this._options.container);
this.$container = document.querySelector(this._options.container);
this.$items = this.$container.querySelectorAll(this._options.item);
this.count = this.$items.length;

Expand Down Expand Up @@ -232,14 +239,6 @@

/**
* export
* @type {Swiper}
*/
if (typeof define === 'function' && define.amd){
define([], function () {
return Swiper;
});
}else {
w.Swiper = Swiper;
}

})(window, document);
return Swiper;
});
Loading

0 comments on commit 83bebaf

Please sign in to comment.