Guest User

Untitled

a guest
Oct 20th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1.  
  2. (function (a) {
  3. a.backstretch = function (k, i, l) {
  4. function m(c) {
  5. try {
  6. f = {
  7. left: 0,
  8. top: 0
  9. };
  10. d = e.width();
  11. b = d / j;
  12. if (b >= e.height()) {
  13. g = (b - e.height()) / 2;
  14. h.centeredY && a.extend(f, {
  15. top: "-" + g + "px"
  16. })
  17. } else {
  18. b = e.height();
  19. d = b * j;
  20. g = (d - e.width()) / 2;
  21. h.centeredX && a.extend(f, {
  22. left: "-" + g + "px"
  23. })
  24. }
  25. a("#backstretch img").width(d).height(b).css(f)
  26. } catch (n) {}
  27. typeof c == "function" && c()
  28. }
  29. var h = {
  30. centeredX: true,
  31. centeredY: true,
  32. speed: 0,
  33. opacity: 1
  34. },
  35. e = "onorientationchange" in window ? a(document) : a(window),
  36. j, d, b, g, f;
  37. i && typeof i == "object" && a.extend(h, i);
  38. a(document).ready(function () {
  39. if (k) {
  40. var c = a("<div />").attr("id", "backstretch").css({
  41. left: 0,
  42. top: 0,
  43. position: "fixed",
  44. overflow: "hidden",
  45. zIndex: -9999,
  46. opacity: h.opacity
  47. }),
  48. n = a("<img />").css({
  49. position: "relative",
  50. display: "none"
  51. }).bind("load", function (o) {
  52. var p = a(this);
  53. j = a(o.target).width() / a(o.target).height();
  54. m(function () {
  55. p.fadeIn(h.speed, function () {
  56. typeof l == "function" && l()
  57. })
  58. })
  59. }).appendTo(c);
  60. a("body").prepend(c);
  61. n.attr("src", k);
  62. a(window).resize(m)
  63. }
  64. });
  65. return this
  66. }
  67. })(jQuery);
Add Comment
Please, Sign In to add comment