Sha256: 57b2737eacc6f0a1eb7c5d250b6e8f74f137915a33ba29ab4e55dc49e861cfa6

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

(function($) {

  $.fn.stable = function() {
    var stable = $(this);
    var top_left_cell = $('.top_left', stable);

    $('#scroll-vertical div', stable).height($('.c-right', stable).height());
    $('#scroll-horizontal div', stable).width($('.c-right', stable).width());

    stable.css('padding-bottom', top_left_cell.outerHeight());
    stable.css('padding-right', top_left_cell.outerWidth());

    stable.addClass('on');

    // Para el Scroll VERTICAL
    $('#scroll-vertical', stable).scroll(function(){
       $('.vertical', stable).scrollTop($(this).scrollTop());
    });

    // Para el Scroll HORIZONTAL
    $('#scroll-horizontal', stable).scroll(function(){
       $('.horizontal', stable).scrollLeft($(this).scrollLeft());
    });

    // Para la tabla
    $('#mask', stable).mousewheel(function(event, delta, deltaX, deltaY) {
      if (!stable.hasClass('on')) return;

      var newLeft = $('.horizontal', stable).scrollLeft() + 25 * deltaX;
      var newTop = $('.vertical', stable).scrollTop() - 25 * deltaY;

      $('.horizontal', stable).scrollLeft(newLeft);
      $('.vertical', stable).scrollTop(newTop);

      $('#scroll-horizontal', stable).scrollLeft(newLeft);
      $('#scroll-vertical', stable).scrollTop(newTop);

      event.preventDefault();
    });
  };

  $(function(){
    $('.stable').stable();
  });

})(jQuery);

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stable-rails-0.0.1 app/assets/javascripts/stable/stable.js