tupali/librerias/notas/script.js

64 lines
1.6 KiB
JavaScript
Raw Normal View History

2017-11-16 17:18:46 +00:00
$('.dropdown-toggle').click(function (){
dropDownFixPosition($('button'),$('.dropdown-menu'));
});
function dropDownFixPosition(button,dropdown){
var dropDownTop = button.offset().top + button.outerHeight();
dropdown.css('top', dropDownTop + "px");
dropdown.css('left', button.offset().left + "px");
}
2017-11-11 03:56:06 +00:00
$(document).ready(function(){
/* This code is executed after the DOM has been completely loaded */
var tmp;
$('.note').each(function(){
/* Finding the biggest z-index value of the notes */
tmp = $(this).css('z-index');
if(tmp>zIndex) zIndex = tmp;
})
/* A helper function for converting a set of elements to draggables: */
make_draggable($('.note'));
2017-11-16 17:18:46 +00:00
$("#muestraInfo").on("hidden.bs.modal", function () {
document.getElementById('modal_landing').className= 'modal-dialog modal-lg';
});
2017-11-11 03:56:06 +00:00
});
2017-11-14 00:43:43 +00:00
var zIndex = 0;
2017-11-11 03:56:06 +00:00
function make_draggable(elements)
{
/* Elements is a jquery object: */
elements.draggable({
//containment:'parent',
start:function(e,ui){ ui.helper.css('z-index',++zIndex); },
stop:function(e,ui){
var left = ui.position.left;
var top = ui.position.top;
var index = zIndex;
/// var id = parseInt(ui.helper.find('span.data').html());
var id = ui.helper.find('span.data').html();
/* Sending the z-index and positon of the note to update_position.php via AJAX GET: */
var datos = [['id',id],['x',left],['y',top],['z',index]];
var formulario = id.split("-", 1);
xajax_notes('','mover',datos,'');
xajax_ultimos_registros(document.getElementById('ultimo_id').value,formulario[0]);
}
});
2017-12-03 01:21:44 +00:00
}