Skip to content

Commit

Permalink
添加文档注释
Browse files Browse the repository at this point in the history
  • Loading branch information
2betop committed Oct 30, 2013
1 parent b1811ee commit a2f4416
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/widget/slider/$dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
(function( gmu, $ ) {
/**
* @property {Number} [edgeThrottle=true0] ???
* @property {Number} [edgeThrottle=0] 默认当slider滚动到第一张或者到最后一张时,会触发edge事件。但如果这个值为1时,当slider滚动倒数第二张时就会触发edge事件。以此类推。
* @namespace options
* @for Slider
* @uses Slider.dynamic
Expand Down Expand Up @@ -91,7 +91,7 @@

// 调整位置,如果能移动的话,将当前的总是移动到中间。
_adjustPos: function( force, ignoreEdge ) {

if ( !force && !this._flag ) {
return;
}
Expand Down Expand Up @@ -132,7 +132,7 @@
},

_renderItems: function( content, index, group ) {
var arr = content.slice( index, index + (index > 0 ? 2 : 3) ),
var arr = content.slice( index, index + (index > 0 ? 2 : 3) ),
rest = 3 - arr.length;

// 避免外部直接修改,影响内部代码
Expand Down
2 changes: 1 addition & 1 deletion src/widget/slider/$lazyloadimg.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},

/**
* 加载图片
* 加载指定item中的图片
* @method loadImage
* @param {Number} index 要加载的图片的序号
* @for Slider
Expand Down
16 changes: 8 additions & 8 deletions src/widget/slider/$multiview.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
(function( gmu, $, undefined ) {
$.extend( gmu.Slider.options, {
/**
* @property {Number} [viewNum=2] ???
* @property {Number} [viewNum=2] 当slider为multiview模式时,用来指定一页显示多少个图片。
* @namespace options
* @for Slider
* @uses Slider.multiview
*/
viewNum: 2,
/**
* @property {Number} [travelSize=2] ???
* @property {Number} [travelSize=2] 用来指定当操作上下导航时,一次滑动多少个张图片,如果这个值与viewNum值一致,就是一次滑动一屏的效果。
* @namespace options
* @for Slider
* @uses Slider.multiview
Expand Down Expand Up @@ -40,12 +40,12 @@

for ( len = items.length; i < len; i++ ) {
item = items[ i ];

item.style.cssText += 'width:' + perWidth + 'px;' +
'left:' + (i * -perWidth) + 'px;';
item.setAttribute( 'data-index', i );

i % viewNum === factor && this._move( i,
i % viewNum === factor && this._move( i,
i < index ? -width : i > index ? width : 0,
0, Math.min( viewNum, len - i ) );
}
Expand Down Expand Up @@ -83,15 +83,15 @@
opts.loop || (dir = Math.abs( from - to ) / (from - to));

diff %= len; // 处理diff大于len的情况

// 相反的距离比viewNum小,不能完成流畅的滚动。
if ( len - diff < viewNum ) {
diff = len - diff;
dir = -1 * dir;
}

offset = Math.max( 0, viewNum - diff );

// 调整初始位置,如果已经在位置上不会重复处理
// touchend中执行过来的,不会执行以下代码
if ( !mode ) {
Expand All @@ -112,7 +112,7 @@
var opts = this._options,
travelSize = opts.travelSize;

if ( opts.loop || (this.index > 0, travelSize =
if ( opts.loop || (this.index > 0, travelSize =
Math.min( this.index, travelSize )) ) {

this.slideTo( this.index - travelSize );
Expand All @@ -129,7 +129,7 @@
if ( opts.loop || (this.index + viewNum < this.length &&
(travelSize = Math.min( this.length - 1 - this.index,
travelSize ))) ) {

this.slideTo( this.index + travelSize );
}

Expand Down

0 comments on commit a2f4416

Please sign in to comment.