source: prototipo_portal_2018/prototipo/static/js/functions/DraggableSortable.js @ 0500480

Last change on this file since 0500480 was 0500480, checked in by José Sulbarán <jsulbaran@…>, 7 years ago

Se modificaron las bottones y las funcionalidades de draggable

  • 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          $('#dataX').val(0);
31          $('#dataY').val(0);
32        }else{
33          $('#dataX').val(ui.position['left']);
34          $('#dataY').val(ui.position['top']);
35        }
36       
37      },
38   
39  });
40}
41
42
43var transferred = false;
44$('.text').draggable({
45    connectToSortable: "div#container1",
46    helper: 'clone',
47    start: function(event, ui)
48    {
49        $(this).hide();
50    },
51    stop: function(event, ui)
52    {
53
54        if(!transferred) {
55            $(this).show();
56        }
57        else{ 
58       
59            $(this).remove();
60            transferred = false;
61        }
62    }
63});
64
65
66$('div#container1').sortable({
67    connectWith: "div#container1",
68    receive: function(event, ui)
69    { 
70        transferred = true;
71        $("#firmar-documento").removeAttr('disabled');
72        InicializarObjectoPositicion()
73        NuevoObjectoInicial();     
74    }
75});
Note: See TracBrowser for help on using the repository browser.