Syntax
Fixnel(element, [options]);
Options
{
direction: '[which direction]',
scrollbarColor: '[any color as CSS colors]',
scrollbarBdrColor: '[any color as CSS colors]',
scrollbarBdrRadius: [number]
}
directionには文字列で、['vertical' | 'horizontal' | 'both']のいずれかを指定するか、 Fixnel.directionType.[VERTICAL | HORIZONTAL | BOTH]のいずれかを指定します。 デフォルトは vertical です。
scroll****は、それぞれスクロールバーの色と丸みを設定します。背景が黒などの場合に色を指定することで視認性が上がります。
Options takes one object as argument. One of options is "direction". That is given a string. Whichever are ['vertical' | 'horizontal' | 'both']. You also can use Fixnel.directionType property. It contains [VERTICAL | HORIZONTAL | BOTH]. Default is "vertical".
scroll*** is scrollbar settings for color and radius. If you use Fixnel on the background color is black, you can apply any color to scrollbar.
Example
//only vertical
var fixnel = new Fixnel(ele);
//only horizontal
var fixnel = new Fixnel(ele, {
direction: Fixnel.directionType.HORIZONTAL
});
//both
var fixnel = new Fixnel(ele, {
direction: Fixnel.directionType.BOTH
});
Instance method
moveToメソッドは、指定されたx, yの座標に移動します。
もしオプションとして {animate: false} を指定すると、アニメーションなしで即座にその場に移動します。
fixnel move to [x, y].
If you give an opt, you can control moving. opt has one property. It is "animate". If you give it to "false", moveTo method move to [x, y] without animation.
update メソッドは高さが変更されたときに呼び出すことで、スクロール量などをアップデートします。
デフォルトでは window.resizeが 発火したタイミングで自動的に実行されるので、スマートフォンの回転時は自動でアップデートされます。
Ajaxなどでコンテンツの中身が動的に変化した場合などに呼び出してください。
update method give to control for contents height changing. If you update contents, you should call the update method. When window.resize was fired, fixnel called update automatically.
Events
fixnel.on('moveendx', function() {...});
movestart[x, y], moveend[x, y], move[x, y]それぞれにイベントが発火されます。
moveイベントのみ、引数として {value: pos} データが渡されます。現在の移動量を返します。
Fixnel fire event each of movestart[x, y], moveend[x, y], move[x, y].
move event takes object ({value: pos}) as argument. It is value of moving amount.