Sha256: 1777abff4f4f5db17532d061598b2ca2ae9fa3522a3489fe3cf3cfd5c74cf8fe
Contents?: true
Size: 545 Bytes
Versions: 2
Compression:
Stored size: 545 Bytes
Contents
jQuery.fn.centerOnScreen = -> win_width = $(window).width() scrollToLeft = $(window).scrollLeft() win_height = $(window).height() scrollToBottom = $(window).scrollTop() box_width = 200 box_height = 200 @css "position", "absolute" @css "z-index", (1000 + (Math.round(Math.random() * 5000))) x = (($(window).width() / 2) - (@width() / 2)) + $(window).scrollLeft() y = (($(window).height() / 2) - (@height() / 2)) + $(window).scrollTop() x = 0 if x < 0 y = 0 if y < 0 @css left: x + "px" top: y + "px" this
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pages_core-3.4.3 | app/assets/javascripts/pages/admin/lib/center_on_screen.js.coffee |
pages_core-3.4.2 | app/assets/javascripts/pages/admin/lib/center_on_screen.js.coffee |