source: firmaeventos/static/js/DraggableSortable.js @ 2c1cb23

Last change on this file since 2c1cb23 was 6312fce, checked in by lhernandez <lhernandez@…>, 7 years ago

Cambios al models Evento, preparando el registro para los nuevo requerimientos

  • Property mode set to 100644
File size: 1.4 KB
Line 
1
2function InicializarObjectoPositicion(){
3  var container = document.getElementById('container1'),
4    element = document.getElementsByClassName('text')[0];
5 
6  // options
7  var options = {
8    limit: container,
9    setCursor: true
10  };
11
12  // initialize drag
13  new Draggable(element, options); 
14
15}
16
17
18function NuevoObjectoInicial(){
19
20  var num = 0;
21  $( ".text" ).draggable({ 
22    containment: '#container1',
23    scroll: false,
24    stop: function(event, ui)
25      {
26       
27        num+= 1;
28        if (num == 1){
29          $("#firma_visible #Formato_Visible .text").hide();
30          console.log(VALOR_X);
31          VALOR_X = 0;
32          VALOR_Y = 0;
33        }else{
34          VALOR_X = parseInt(ui.position['left']);
35          VALOR_Y = parseInt(ui.position['top']);
36        }
37       
38      },
39   
40  });
41}
42
43
44var transferred = false;
45$('.text').draggable({
46    connectToSortable: "div#container1",
47    helper: 'clone',
48    start: function(event, ui)
49    {
50        $(this).hide();
51    },
52    stop: function(event, ui)
53    {
54
55        if(!transferred) {
56            $(this).show();
57        }
58        else{ 
59       
60            $(this).remove();
61            transferred = false;
62        }
63    }
64});
65
66
67$('div#container1').sortable({
68    connectWith: "div#container1",
69    receive: function(event, ui)
70    { 
71        transferred = true;
72        $("#firmar-documento").removeAttr('disabled');
73        InicializarObjectoPositicion()
74        NuevoObjectoInicial();     
75    }
76});
Note: See TracBrowser for help on using the repository browser.