/* jquey giant jump plugin */
/*
usage:
$('binding element').giant_jump({
  to:'to_here element',
  action:'click',
  speed: 500
});

memo:jqueryのevent
- blur
- focus
- focusin
- focusout
- load
- resize
- scroll
- unload
- click
- dblclick
- mousedown
- mouseup
- mousemove
- mouseover
- mouseenter
- mouseleave
- change
- select
- submit
- keydown
- keypress
- keyup
- error

todo:
- アクションを外から当てこめるように
*/

(function($){
var version = "0.1";
$.fn.giant_jump = function(options){
  options = options || {};
  var opts = $.extend({}, $.fn.giant_jump.defaults, options);
  
  return this.each(function(idx,el){
    var $el = $(el);
    $el.bind(opts.action, [], function(){
      var tgt = $(opts.to).offset().top;
      
	  if($.browser["opera"]){
		  $('html,body').scrollTop(tgt);
		  return false
	  }

	  $('html,body').animate({
        scrollTop:tgt
      },opts.speed);
    });
  });
}

$.fn.giant_jump.version = function(){return version};
$.fn.giant_jump.defaults = {
  to:'body',
  action:'click',
  speed:500
};
})(jQuery);

