Sha256: 714e15887ac476b49ee599cf62e000c4c4e3fac3accdf69a4f3dbbfc39ddd72e

Contents?: true

Size: 458 Bytes

Versions: 1

Compression:

Stored size: 458 Bytes

Contents

jQuery.fn.centerOnScreen = function() {
  this.css("position", "absolute");
  this.css("z-index", 1000 + (Math.round(Math.random() * 5000)));

  var x = (($(window).width() / 2) - (this.width() / 2)) +
          $(window).scrollLeft();

  var y = (($(window).height() / 2) - (this.height() / 2)) +
          $(window).scrollTop();

  if (x < 0) {
    x = 0;
  }

  if (y < 0) {
    y = 0;
  }

  this.css({left: x + "px", top: y + "px"});

  return this;
};

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pages_core-3.5.1 app/assets/javascripts/pages/admin/lib/center_on_screen.es6.jsx