Skip to content
JavaScript, window.scrollTo by location.hash
JavaScript HTML
Find file
Latest commit 2ec1744 @taikiken bower
Failed to load latest commit information.
_gulp
docs
example
libs 0.1.3
old
src
LICENSE Initial commit
README.md
bower.json
bower.memo bower
index.html
yuidoc.json jQuery plugin added

README.md

yamori.js

JavaScript, window.scrollTo by location.hash

version: 0.1.2
build: 2015-07-17 21:35:17

hash付遷移時に window.onload 後にスムーズスクロール

依存

jQuery 1.7 以上

推奨
jQuery 1.8 以上

jQuery Easing Plugin を使用しています。

API

API

使用方法

1. 読み込むだけで機能させる。

<script id="yamori" src="yamori.min.js"></script>

2. 読み込だけさせて手動で機能させる。

<script src="yamori.min.js"></script>
<script>
    // * DOMReady 前に実行
    $.yamori();
    // or
    window.Yamori.activate();
</script>

オプション

easing

type {String}

default: "quart"

easing 関数一覧
jQuery Easing Plugin

  • quart
  • easeInQuad
  • easeOutQuad
  • easeInOutQuad
  • easeInCubic
  • easeOutCubic
  • easeInOutCubic
  • easeInQuart
  • easeOutQuart
  • easeInOutQuart
  • easeInQuint
  • easeOutQuint
  • easeInOutQuint
  • easeInSine
  • easeOutSine
  • easeInOutSine
  • easeInExpo
  • easeOutExpo
  • easeInOutExpo
  • easeInCirc
  • easeOutCirc
  • easeInOutCirc
  • easeInElastic
  • easeOutElastic
  • easeInOutElastic
  • easeInBack
  • easeOutBack
  • easeInOutBack
  • easeInBounce
  • easeOutBounce
  • easeInOutBounce

duration

type {Number}

default: 500

start

type {Function}

default: null

// callback
hash {string} 移動先 id
target {Element} 移動先 HTMLElement
$target {jQuery} 移動先 jQuery object
y {number} 移動先 offset top

start( hash, target, $target, y );
  • jQuery 1.7 では動作しません、1.8以上で機能します。

complete

type {Function}

default: null

// callback
hash {string} 移動先 id
target {Element} 移動先 HTMLElement
$target {jQuery} 移動先 jQuery object
y {number} 移動先 offset top

complete( hash, target, $target, y );

click で リンクのハッシュコンテナへ移動

<a href="#example" class="yamori">Example</a>

<div id="example"></div>

【Script】

<script>
    $( ".yamori" ).yamori();
</script>
Something went wrong with that request. Please try again.