Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function ab(load) {
  2.  
  3.     l = load;
  4.  
  5.     $('body').append('<div id="overlay" />');
  6.     $('#overlay').fadeIn(300, function() {
  7.         $('body').append('<div id="alertModalOuter"><div id="alertModal"></div></div>');
  8.         var outer = $('#alertModalOuter');
  9.         var modal = $('#alertModal');
  10.         var defWidth = outer.outerWidth();
  11.         var defHeight = outer.outerHeight();
  12.         modal.load('alert.html' + ' #alert', function() {
  13.        
  14.             var alertBoxContent = $('#alert');
  15.            
  16.             var alertWidth = alertBoxContent.outerWidth();
  17.             var alertHeight = alertBoxContent.outerHeight();
  18.            
  19.             var widthCombine = -((defWidth + alertWidth) / 2);
  20.             var heightCombine = -((defHeight + alertHeight) / 2);
  21.  
  22.             modal.animate({width: alertWidth, height: alertHeight}, 200);
  23.             outer.animate({marginLeft: widthCombine, marginTop: heightCombine}, 200, function() {
  24.                 alertBoxContent.fadeIn(200, function() {
  25.                     $('#yes').click(function(e) {
  26.                         e.preventDefault();
  27.                         window.location.href = l;
  28.                     });
  29.                     $('#no').click(function(e) {
  30.                         e.preventDefault();
  31.                         $('#overlay, #alertModalOuter').fadeOut(400, function() {
  32.                             $(this).remove();
  33.                         });
  34.                     });
  35.                 });
  36.             });
  37.  
  38.         });
  39.     });
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement