Blame view

js/bpopup/scripting.js 3.03 KB
bde80a8f   andryeyev   + Модальные окна
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
  (function(a) {
  
      var m = a("#popup"), n = a("#popup2"), d = 0;
  
      a(function() {
          a(".small.special").on("open.bpopup",function() {
              alert("I'm special")
          });
          a("body").on("click",".small",function() {
              var c = a(this).hasClass("pop1")? m : n , 
                  h = a(".content"),
                  j = a(this);
              if (a(this).hasClass("events"))
                  c.bPopup ({
                      onOpen: function() {
                          alert("onOpen fired")
                      },
                      onClose: function(){
                          alert("onClose fired")
                      }
                  }, function(){
                      alert("Callback fired")
                  });
                  else if (a(this).hasClass("random")) {
                      var e = b(0, a(window).width() - 500),
                          p = b(a(document).scrollTop(), 
                          a(document).scrollTop() + a(window).height() - 300),
                          k = 3 == b (0,4),
                          l = b(0,2),
                          f = "fadeIn",
                          g = 350;
                          1 === l ? (f = "slideDown", g = 600) : 2 === l && (f = "slideIn", g = 500);
                          c.bPopup ({
                              follow: k ? [!0, !0] : [!1, !1],
                              position: !k ? [e,p] : ["auto","auto"], 
                              opacity: "0." + b(1, 9), positionStyle : 25 == b (0, 50) ? "fixed": "absolute",
                              modal: 0 == b(0, 10) ? !1: !0,
                              modalClose: 0 == b(0, 5) ? !1: !0,
                              modalColor: "hsl(" + b(0,360) + ",100%, 50%)",
                              transition: f, 
                              speed: g
                          })
                  } else  a(this).hasClass("x-content") ? c.bPopup({
                          onOpen: function(){
                              h.html (j.data("bpopup") || {})
                          },
                          onClose: function() {
                              h.empty()
                          }
                  }) :a(this).hasClass("multi") ? (
                      d++,
                      c = b(0,a(window).width()-500),
                      e = b(a(document).scrollTop(), a(document).scrollTop() + 
                          a(window).height() - 300),
                          a('<div class="bMulti"><span class="button bClose close' + d + '"><span>X</span></span><p>' + d + '</p><a class="button small multi">Pop another up</a></div>'). bPopup({
                              closeClass: "close" + d,
                              position: [c, e],
                              follow: [!1, !1],
                              onClose: function() {
                                  d--;
                                  a(this).remove()
                              }
                          })
                  ) : c.bPopup (j.data("bpopup") || {} ) 
              })
          });
          var b = function(a, b) {
              return ~~ (Math.random() * (b - a + 1) + a)
      }
  })(jQuery);