Blame view

js/msg.js 1.61 KB
42868d70   andryeyev   Создал GIT
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
  (function($){
      $.fn.msg = function() {
      var obj = this;
  
  
      var win = function(id_win,e,title){
              $win = $('<div id='+id_win+' class="win"></div>');
                  $win.css({
                      'border-radius': 5 + 'px'
                      ,'-moz-border-radius': 5 + 'px'
                      ,'-webkit-border-radius': 5 + 'px'
                  });
                  var cnt = '<div class="cont_win">';
                  if($(e).attr('href')!="#")cnt += ' <img src="'+$(e).attr('href')+'" align="left" />';
  				cnt += title;
                  cnt += '</div>';
                  $content = $(cnt);
                  $close = $('<div class="close_win"></div>');
                  $($close).bind('click',function(){
                   $($win).hide();
                  });
                  
                      offSetTop = $(e).offset().top - 150;
                      offSetLeft = $(e).offset().left + $(e).outerWidth() - 115;
                      $win.css({'top' : offSetTop + 'px', 'left' : offSetLeft + 'px'});
               $($win).append($close);
               $($win).append($content);
               $('body').append($win);
      }
  
  
  
      var find = function(){ 
       $(obj).each(function (i) {
         var href = $(this).attr('href');
         var title = $(this).attr('title');
         var id_win = 'msg_win'+i;
         $(this).bind('click',function(){
         $('.win').remove();
          win(id_win,this,title);
         return false;
         })
       })
      }
      
      var close = function(id){
      $('#tip_close').bind('click',function(){
       $('#'+id).remove();
      });
      }
      
  
      find();
  
      };
  })(jQuery);
  $(function(){
   $("a[rel~='msg']").msg();
  })